GadgetGroup ( gadget )
Parameters
| gadget - gadget to read the parent of |
Description
|
Returns the handle of the group a gadget belongs to, or 0 for a window. Requires Extended language mode. Every gadget lives inside the group it was created in - the window, panel, group box, splitter pane or tabber page you passed as its group parameter. GadgetGroup walks one step up that tree. Top-level windows have no parent and return 0, so a loop of GadgetGroup calls climbs from any gadget to its window: While GadgetGroup(g) <> 0 g=GadgetGroup(g) Wend ; g is now the window That is handy in a generic event handler: an event tells you the gadget, GadgetGroup tells you whose window or panel it belongs to, without you keeping a lookup table. The parent also defines the gadget's coordinate space - GadgetX and GadgetY are relative to this group's client area - and its fate: freeing the group frees the gadget. The world editor shell sample shows the nested layout this navigates. See also: CreateWindow, CreatePanel, GadgetX, ClientWidth, EventSource. |
Index