Can I delete an image after adding it to the ImageGadget?
Can I delete an image after adding it to the ImageGadget?
Or does the image have to be available with its ImageID as long as I want to display it in the ImageGadget?
Re: Can I delete an image after adding it to the ImageGadget?
Hi Lebostein,
You can find some useful functions for image management in ImageGadget() and more here:
viewtopic.php?t=85730
This should help you
You can find some useful functions for image management in ImageGadget() and more here:
viewtopic.php?t=85730
This should help you
PureBasicien tu es, PureBasicien tu resteras.
Re: Can I delete an image after adding it to the ImageGadget?
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?
Re: Can I delete an image after adding it to the ImageGadget?
It seems that an image should not be removed on Windows.
Instead of using RedrawWindow, you can move the window to an offscreen area and then move it back and see that both images have been erased.
Instead of using RedrawWindow, you can move the window to an offscreen area and then move it back and see that both images have been erased.
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
Re: Can I delete an image after adding it to the ImageGadget?
Hello, i think the solution is canvasgadget. Can draw the image in a canvas. Delete the image no give error.
If translation=Error: reply="Sorry, Im Spanish": Endif
Re: Can I delete an image after adding it to the ImageGadget?
If it works on Linux and MacOS, there is an inconsistency here and the image should be duplicated on Windows as well.