FreeGadget gadget
Parameters
| gadget - gadget or window to destroy |
Description
|
Destroys a gadget or window, along with everything inside it. Requires Extended language mode. Removes the gadget from the screen and frees it for good. Freeing a container - a window, panel, group box, splitter or tabber - takes all of its children with it, so closing a whole tool window is one call. Every freed handle (and every descendant's) becomes invalid; using one afterwards stops with a runtime error. GUI handles are never reused during a run, so a stale handle can never quietly point at something new. The most important pairing is the window close button: clicking it posts a window-close event ($803) but deliberately does not destroy anything. Your event loop decides - maybe asking "Save changes?" first - and calls FreeGadget on the window to actually close it: Case $803 If EventSource() = mainWindow Then FreeGadget mainWindow : End FreeGadget 0 is a harmless no-op. Queued events from a freed gadget will no longer match any live handle; flush them with FlushEvents if you want the queue clean. Every sample ends this way - see the window and button sample for the smallest version and the world editor shell sample for a full editor's. See also: CreateWindow, HideGadget, FreeTreeViewNode, FreeIconStrip, FlushEvents. |
Index