Is there a way to assign a Structure to the ColumnTag of a ListBox, with a different set of values in each tag?
I want to have several fields stored in the ColumnTag, but I see I cannot just do:
ListBox.ColumnTag(i) = New ColumnInfo
(Where ColumnInfo is a structure)
I know I can just create another array of Structure outside the ColumnTag array, but that’s a bit redundant…
Can a variant be a Class? If so, then I could use a Class in place of a Structure…
structures are not a reference type so you dont use “new” them
you’d get an error if you tried to do
dim t as new ColumnInfo
the ColumnTag is a variant and varaitns do not have, or understand, the objects that may be stored in them
you’d have to use a cast to make sure the tag is handled as a ColumnTagClass - since it could be one of those or just about anything else
something like
pay attention to the ()'s
this accesses the celltag - ListBox1.ColumnTag(i) - and then tells Xojo to treat this as if it was a ColumnTagClass
Thank you. I was trying to figure out how to Cast variables in Xojo. I tried CType(Variable, Type) but that didn’t work.
Coming from C# I was used to the (type)(variable) syntax. Looks like it’s just type(variable) in Xojo.