Page 1 of 1
PB_EventType_FreeGadget
Posted: Tue Aug 01, 2017 2:39 pm
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.
Re: PB_EventType_FreeGadget
Posted: Tue Aug 01, 2017 6:23 pm
by mk-soft
Re: PB_EventType_FreeGadget
Posted: Tue Aug 01, 2017 6:59 pm
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.
Re: PB_EventType_FreeGadget
Posted: Tue Aug 01, 2017 7:31 pm
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
Re: PB_EventType_FreeGadget
Posted: Fri Aug 04, 2017 10:21 pm
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.
Re: PB_EventType_FreeGadget
Posted: Sat Aug 05, 2017 7:04 pm
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.