"Me" keyword for current gadget number
Posted: Fri Aug 14, 2009 2:01 pm
I would like to see an internal variable (called "Me" like in Visual Basic)
that holds the current gadget number that was created by any of the
gadget commands, to reduce typing the same gadget name over and
over. Sort of like With/EndWith. Here's what I mean:
The above code could be replaced with something like this:
See how it eliminates the need to type the gadget's constant name over
and over? The internal variable "Me" would just be updated by the
compiler every time a new gadget command is reached. Don't give it
a long name (like "CurrentGadget") because that defeats the purpose.
I just want something quick to type in place of the gadget number so
I don't need to type the name again and again every time I add to it.
that holds the current gadget number that was created by any of the
gadget commands, to reduce typing the same gadget name over and
over. Sort of like With/EndWith. Here's what I mean:
Code: Select all
Enumeration
#NumberSelection
#NameList
EndEnumeration
If OpenWindow(0,300,250,400,200,"test",#PB_Window_SystemMenu)
ComboBoxGadget(#NumberSelection,10,10,70,22)
AddGadgetItem(#NumberSelection,-1,"One")
AddGadgetItem(#NumberSelection,-1,"Two")
AddGadgetItem(#NumberSelection,-1,"Three")
SetGadgetText(#NumberSelection,"One")
GadgetToolTip(#NumberSelection,"Sets the number")
ListIconGadget(#NameList,100,10,200,100,"Names",180)
AddGadgetItem(#NameList,-1,"Fred")
AddGadgetItem(#NameList,-1,"Freak")
AddGadgetItem(#NameList,-1,"Berikco")
DisableGadget(#NameList,#True)
GadgetToolTip(#NameList,"List of team members")
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
Code: Select all
Enumeration
#NumberSelection
#NameList
EndEnumeration
If OpenWindow(0,300,250,400,200,"test",#PB_Window_SystemMenu)
ComboBoxGadget(#NumberSelection,10,10,70,22)
AddGadgetItem(Me,-1,"One")
AddGadgetItem(Me,-1,"Two")
AddGadgetItem(Me,-1,"Three")
SetGadgetText(Me,"One")
GadgetToolTip(Me,"Sets the number")
ListIconGadget(#NameList,100,10,200,100,"Names",180)
AddGadgetItem(Me,-1,"Fred")
AddGadgetItem(Me,-1,"Freak")
AddGadgetItem(Me,-1,"Berikco")
DisableGadget(Me,#True)
GadgetToolTip(Me,"List of team members")
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
and over? The internal variable "Me" would just be updated by the
compiler every time a new gadget command is reached. Don't give it
a long name (like "CurrentGadget") because that defeats the purpose.
I just want something quick to type in place of the gadget number so
I don't need to type the name again and again every time I add to it.