Page 1 of 1

IndexOf(MyStruct,i.l)

Posted: Thu Oct 13, 2005 10:11 pm
by Flype
Just an idea while i'm programming...

you know SizeOf(MyStruct)
you know OffsetOf(MyStruct/fieldName)

what about IndexOf(MyStruct,index.l)

a little snippet, for showing what i'm talking about:

Code: Select all

Structure PEOPLE
  firstName.s
  nickName.s
  birthDate.s
  comment.s
EndStructure

MyItem.PEOPLE

For i=0 To 3
  Debug IndexOf(MyItem,i) ; for easy field-debugging
Next

line$ = ""

For i=0 To 3
  line$ + IndexOf(MyItem,i) + Chr(10) ; for easy field-appending
Next

AddGadgetItem(#ListIcon,-1,line$)

Posted: Thu Oct 13, 2005 10:25 pm
by va!n
i think its ok, when you have posted it in the v4 wishlist :wink: and people can discuss there :wink:
viewtopic.php?t=7853&start=165
:D

Posted: Thu Oct 13, 2005 11:32 pm
by Fred
This will be not possible, as we don't have a runtime information on each structure to do that (OffsetOf() and SizeOf() are compiler directives which are evaluated at compile-time, not runtime).