Can I delete an image after adding it to the ImageGadget?
Posted: Thu Jun 05, 2025 6:51 am
Or does the image have to be available with its ImageID as long as I want to display it in the ImageGadget?
http://www.purebasic.com
https://www.purebasic.fr/english/
If you don't want to use the image later (beside of the ImageGadget), I think you can free the image without problem, but it's not needed.Lebostein wrote: Thu Jun 05, 2025 6:51 am Or does the image have to be available with its ImageID as long as I want to display it in the ImageGadget?
Code: Select all
If OpenWindow(0, 0, 0, 245, 105, "ImageGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If LoadImage(0, #PB_Compiler_Home + "examples/sources/Data/Map.bmp")
ImageGadget(0, 10, 10, 100, 83, ImageID(0)) ; imagegadget standard
ImageGadget(1, 130, 10, 100, 83, ImageID(0), #PB_Image_Border) ; imagegadget with border
FreeImage(0)
RedrawWindow_(WindowID(0), 0, 0, #RDW_ERASENOW | #RDW_UPDATENOW | #RDW_INVALIDATE | #RDW_ALLCHILDREN | #RDW_ERASE)
EndIf
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf