Change the Group of a MaxGUI Gadget?
BlitzMax Forums/BlitzMax Programming/Change the Group of a MaxGUI Gadget?
| ||
I can set the group when I create it. I can retrieve the group by using GadgetGroup, but there does not appear to be a SetGadgetGroup command. Is there a way to do it, or not? |
| ||
Not that I know of (though I'm no expert). Perhaps you could work around that by deleting/recreating gadgets to reassign groups (you've probably already considered that <g>)? |
| ||
Yeah, unfortunately the only reason I want to change the group is to work around my program crashing when I delete the gadget. I figured if I could remove it from it's parent gadget, I can delete all other gadgets apart from this one until there's a bugfix for canvases being freed. Ah well, no matter. I guess I can just not free anything for now. |
| ||
Wasn't there a workaround to first call SetGraphics (CanvasGraphics()) before freeing it? |
| ||
Yes, but that clashes with the other renderer. Dunno why. It shouldn't really. |
| ||
Does this do it?SuperStrict Local MyWindow:TGadget = CreateWindow("Canvas Example" , 200 , 200 , 320 , 240) Local mywindow2:TGadget = CreateWindow("Dummy window" , 400,400,200,200) Local MyCanvas:TGadget=CreateCanvas(10,10,290,140,MyWindow) Repeat WaitEvent() Select EventID() Case EVENT_WINDOWCLOSE End Case EVENT_GADGETPAINT SetGraphics CanvasGraphics (MyCanvas) DrawRect 20,20,50,80 Flip Case EVENT_MOUSEDOWN Print "fIRED" mycanvas._setparent(mywindow2) End Select Local current_group:TGadget = GadgetGroup(mycanvas) DebugLog gadgettext(current_group) Forever There is also a driver.setgroup method but it's commented out. <edit> To use gadgettext. |
| ||
That works for me. Thanks Tony! |
| ||
mycanvas._setparent(mywindow2) This tweak should be converted to a new maxgui function (SetGadgetGroup) and posted in the Module Tweaks forum. Skid & mark could then make it an official addition (which is much more likely when it works cross-platform). |
| ||
There is a reason why it isn't setparent is used in combinatin with other functions and if you use it on gadgets without calling the rest, you risk that relationships break and your whole app makes baba boom. there is a thread where skid commented on that with more or less that answer when I remember correctly. |
| ||
If you could find it, that would be good. I did see this where Skid didn't make much comment and, from that, suggests it can be used. I did also notice this where the same issue was raised before. I think it should have it's own function and the request made to BRL. However, I'm tired of requesting things only to be ignored. |
| ||
The GUI is still far away from the point of beeing really usable compared to Blitz Plus or anything ... but it is at least a base to build on. *Although I still hope that this base gets some additions like EventHandles on the Gadgets directly* |
| ||
If you could find that thread it'd be appreciated. |