[lazarus] "Variant" variable ?

Michael Van Canneyt michael.vancanneyt at wisa.be
Wed Apr 26 17:21:40 EDT 2000




On Wed, 26 Apr 2000, dvortex wrote:

> 2 things:
> 
> Where is TVarRec declared ?
> (so i can start from there and overload it ... --hehehe i love that
> word--)
> 
> Can someone tell me if this is correct:
> 
> Load typinfo.pp from ./rtl/objpas.pp
> go to line 90
> this is the declaration of a type called TTypeData (if i read this right).
> The first line under (line 91) is a case statement (sort of like what i
> asked earlier). i do not understand how this works. it doesn't make any
> sense to me. i visualize this as having a record that has different
> property depending of the value of one.

Correct.

> 
> for instance, if mastervalue is "175" then there will also be a property
> called "subvalue" of a certain type, which would be different is
> mastervalue had a different value. In this case (the typinfo.pp), i don't
> see the "mastervalue" element/property... 

It is in the Case statement.

Case A : Integer of
  1 : (X : String;);
  2 : (Y : Longint);
end;

If A=1 then you can access X as a string
If A=2 then you can access Y as a Longint.

> 
> someone care to spend some time to explain to me this ?

Have a look at the docs.

Michael.






More information about the Lazarus mailing list