I'm working on a program that will need to use a lot of MaxGUI gadgets and I am having trouble developing a system to manage them all.
When I worked with Blitz3D, the way I would handle the interface is to have each gadget have a Tag$ field. Then when I checked for events I would just reference the objects by tag like so:
ButtonClicked$ = GetEvent()
If ButtonClicked$ = "mainheader_one"
...
MaxGUI seems to use a system whereby the object itself is returned instead of a tag or handle (From EventSource())
This would be fine, except as you can see in my example above I used a constant (the "mainheader_one" bit) to reference what button was clicked. Now seeing as I must either reference the object itself (which I can't provide a constant for) or a handle which is not constant, I am forced to use a variable to store the gadget like:
If EventSource() = MyGadget:TGadget
...
Seeing as my program may very well use hundreds of gadgets, having to store hundreds of global variables seems to be a rather unelegant solution to the problem. I have looked through the module source files and have been unable to find a field that:
1) Is a string (so I can reference it like EventSource.x$ = "MyGadgetName")
2) All gadgets have the field (i.e. not just windows or buttons)
3) Remains constant throughout program operation
In all of the MaxGUI examples the gadgets are all referenced by a variable storing the object. Clearly this would become unwieldly if you were to have several hundered gadgets (and therefore several hundred unique variables). I have proposed a simple tag system to reference individual gadgets, but if anyone else has made use of a program which utilized a different system, I'd be interested to hear it as well.
Any help would be greatly appreciated.
When I worked with Blitz3D, the way I would handle the interface is to have each gadget have a Tag$ field. Then when I checked for events I would just reference the objects by tag like so:
ButtonClicked$ = GetEvent()
If ButtonClicked$ = "mainheader_one"
...
MaxGUI seems to use a system whereby the object itself is returned instead of a tag or handle (From EventSource())
This would be fine, except as you can see in my example above I used a constant (the "mainheader_one" bit) to reference what button was clicked. Now seeing as I must either reference the object itself (which I can't provide a constant for) or a handle which is not constant, I am forced to use a variable to store the gadget like:
If EventSource() = MyGadget:TGadget
...
Seeing as my program may very well use hundreds of gadgets, having to store hundreds of global variables seems to be a rather unelegant solution to the problem. I have looked through the module source files and have been unable to find a field that:
1) Is a string (so I can reference it like EventSource.x$ = "MyGadgetName")
2) All gadgets have the field (i.e. not just windows or buttons)
3) Remains constant throughout program operation
In all of the MaxGUI examples the gadgets are all referenced by a variable storing the object. Clearly this would become unwieldly if you were to have several hundered gadgets (and therefore several hundred unique variables). I have proposed a simple tag system to reference individual gadgets, but if anyone else has made use of a program which utilized a different system, I'd be interested to hear it as well.
Any help would be greatly appreciated.