CreateButton ( text$,x,y,width,height,group[,style] )
Parameters
|
text$ - button label x,y - position of the button's top-left corner within the group's client area width,height - size of the button group - window or gadget group that owns the button style (optional) - type of button 1: push button (default) 2: checkbox 3: radio button 4: default push button, triggered by Enter 5: cancel push button, triggered by Escape |
Description
|
Creates a native button gadget and returns its handle. Requires Extended language mode. The workhorse of any tool window: Apply, Save, Delete selected. Clicking a button posts a gadget-action event ($401) on the shared event queue with EventSource set to the button's handle, which is how your event loop tells buttons apart - the returned handle is a positive, type-checked ID you compare against EventSource. Checkboxes (style 2) and radio buttons (style 3) keep a checked state: read it with ButtonState, set it with SetButtonState, and note that their $401 events carry the new state in EventData. Radio buttons that share a parent group act as one exclusive set, so put each set in its own panel or group box. Coordinates and size are logical 96-DPI units relative to the group's client area - DPI scaling is handled for you. The label is UTF-8 and can be changed later with SetGadgetText. See it working in the window and button sample and the world editor shell sample. See also: ButtonState, SetButtonState, SetGadgetText, EventSource, CreateWindow, ActivateGadget. |
Index