SetProxy()

BlitzMax Forums/MaxGUI Module/SetProxy()

degac(Posted 2008) [#1]
I have some problems to understand how SetProxy() exactly works.
With SetProxy you can setup what is the 'main gadget' in your own-gadget.
But...

I have an user-gadget (like in the following example) that is composed by 2 (or more) sub-gadgets; I have problems to extends the standard gadget commands to work with my user-gadget.
In this case DISABLEGADGET what it really does? It disable the panel gadget? And the others?

I think I'm a little lost....




SebHoll(Posted 2008) [#2]
The TProxyGadget simply allows you to set-up custom gadgets so that they can be used with the standard set of MaxGUI commands, such as DisableGadget(), SetGadgetColor() etc.

This is done by setting a real gadget as the proxy gadget, which in your case appears to be panel, to which all commands are forwarded on to. Therefore, any time you call a MaxGUI command (such as DisableGadget()) on your TMulti custom gadget, it is effectively the same as calling it on TMulti.panel.

The behaviour you are experiencing is as expected - the panel is disabled which on Windows means that the panel becomes greyed out, and the children are also disabled (but don't appear so, this is just the OS standard - only the parent appears greyed out, although the children become desensitized).

If you really want the button to be greyed out too, then you'll need to override the SetEnabled(bool) by adding a new method somewhere in TMulti so that is passes the message onto both the panel and the button. For example,



Finally, I perhaps should also mention that you don't need to import MaxGUI.ProxyGadgets to make your own custom TProxyGadgets - all this is defined in MaxGUI.MaxGUI which is imported by MaxGUI.Drivers. MaxGUI.ProxyGadgets simply contains standard MaxGUI custom gadgets such as the hyperlink control (which wraps a label). If you aren't using the hyperlink control, you don't need to import it.

Edit: However, you might want to take a look into MaxGUI.ProxyGadget's source, as you will see how I do proxy gadgets.


degac(Posted 2008) [#3]
Oh many thanks. Now it's more clear.
I think I will checkout better the gadget.bmx+magui.bmx type structure to know what methods are used.
Thank you very much.

PS:as for import Maxgui.Proxygadgets I made a copy&paste of the hyperlink gadget example: this means that this example must be changed...


SebHoll(Posted 2008) [#4]
PS:as for import Maxgui.Proxygadgets I made a copy&paste of the hyperlink gadget example: this means that this example must be changed...

Well that's not quite right - the hyperlink example needs to import MaxGUI.ProxyGadgets as it is using the hyperlink proxy gadget control. ;-) For your own proxy gadgets however, you do not need to import it.


degac(Posted 2008) [#5]
(Homer Simpson's voice)Doh!
I'm very stupid...sorry :D