Canvas #PB_EventType_Destroy

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

Canvas #PB_EventType_Destroy

Post by Justin »

It would be possible to have a binded event that gets called just before the canvas is destroyed as a last event?
Often you have to set some memory using SetGadgetData() that needs to be freed when the gadget is destroyed.
Doing it manually is not reliable when the gadget is not explicitly freed by you.
User avatar
Bisonte
Addict
Addict
Posts: 1313
Joined: Tue Oct 09, 2007 2:15 am

Re: Canvas #PB_EventType_Destroy

Post by Bisonte »

On Windows you can make it with a Callback... Like AddEvents
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Re: Canvas #PB_EventType_Destroy

Post by Justin »

Thanks, I know it can be done with the api, windows and linux are easy, mac more difficult although it can be done, a native solution is needed.
Fred
Administrator
Administrator
Posts: 18220
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Canvas #PB_EventType_Destroy

Post by Fred »

I agree it could useful when using custom data. Probably for all gadgets as well.
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Re: Canvas #PB_EventType_Destroy

Post by Justin »

Great, hopefully in the next version
User avatar
mk-soft
Always Here
Always Here
Posts: 6245
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Canvas #PB_EventType_Destroy

Post by mk-soft »

Perhaps better a SetFreeGadgetCallback 😉
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: 948
Joined: Sat Apr 26, 2003 2:49 pm

Re: Canvas #PB_EventType_Destroy

Post by Justin »

Yes that sounds better, my attemp fails in some apple systems
User avatar
SPH
Enthusiast
Enthusiast
Posts: 571
Joined: Tue Jan 04, 2011 6:21 pm

Re: Canvas #PB_EventType_Destroy

Post by SPH »

Fred wrote: Sun Sep 29, 2024 4:59 pm I agree it could useful when using custom data. Probably for all gadgets as well.

!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 6.12LTS - 64 bits
Post Reply