Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Compile Problem With Variant Array
Thu, Feb 22 2018 10:21 AMPermanent Link

Frederick Chin

I have a variant array defined as follows:-

var
  aTest : array of Variant;
begin
    setlength(aTest, 1);
    aTest[0]:=False;

    TLabel1.Visible:=not aTest[0];  // Compiles OK

    if not aTest[0]. then   // Compiler says "Expected boolean or integer but instead found not aTest[0]
       TLabel1.Visible:=False;
end;

Is this expected behaviour and if yes, why?

--
Frederick
Thu, Feb 22 2018 3:28 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Frederick,

<< Is this expected behaviour and if yes, why? >>

No, it's a "limitation" in the compiler.  It's not quite a bug because variants were originally only added to support JSON persistence and not actually documented, but they've been expanded over time to be used by everyone so I will make sure that this is fixed.

Tim Young
Elevate Software
www.elevatesoft.com
Fri, Feb 23 2018 5:38 PMPermanent Link

Frederick Chin

Tim,

/*
No, it's a "limitation" in the compiler.  It's not quite a bug because variants were originally only added to support JSON persistence and not actually documented, but they've been expanded over time to be used by everyone so I will make sure that this is fixed.
*/

Thanks. I've worked around it for now by using:

if aTest[0]=False then   
  TLabel1.Visible:=False;

--
Frederick
Image