PB_EventType_FreeGadget

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Justin
Addict
Addict
Posts: 832
Joined: Sat Apr 26, 2003 2:49 pm

PB_EventType_FreeGadget

Post by Justin »

when using the canvas gadget you often have to store the canvas properties on the gadget data, the event should be useful to free the data when just before the gadget gets destroyed instead of keeping track of all the created gagets.
User avatar
mk-soft
Always Here
Always Here
Posts: 5398
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB_EventType_FreeGadget

Post by mk-soft »

+1 :wink:

At time you can use this module...

Link: http://www.purebasic.fr/english/viewtop ... 12&t=64151
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Justin
Addict
Addict
Posts: 832
Joined: Sat Apr 26, 2003 2:49 pm

Re: PB_EventType_FreeGadget

Post by Justin »

Thanks for the code. In windows and linux should be much easier to handle the destroy messages i could do it but no idea with mac.
User avatar
mk-soft
Always Here
Always Here
Posts: 5398
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB_EventType_FreeGadget

Post by mk-soft »

Runs on all OS. With MacOS, there is the problem that the internal GadgetList is updated only after calling WaitWindowEvent (). Therefore the difference to MacOS.

P.S. Found a bug in my module... Updated
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
mk-soft
Always Here
Always Here
Posts: 5398
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: PB_EventType_FreeGadget

Post by mk-soft »

I think is better to add new function AddGadgetCallback(Gadget, #PB_FreeGadget, Callback) and AddWindowCallback(Window, #PB_CloseWindow, Callback)
This is invoke the functions before destroyed the Gadget or Window.
I event is to late.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Justin
Addict
Addict
Posts: 832
Joined: Sat Apr 26, 2003 2:49 pm

Re: PB_EventType_FreeGadget

Post by Justin »

Yes. In windows i tried to bind to the WM_DESTROY message and it works the gadget still exists but in linux doesn't, in the destroy signal the gadget is already freed by PB so we need a native PB function.
Post Reply