Blitz3D+ Command Reference

ButtonState ( button )

Parameters

button - checkbox or radio button gadget to query

Description

Returns 1 if a checkbox or radio button is checked, 0 if not.

Requires Extended language mode.

Reads the checked state of a button created with CreateButton style 2 (checkbox) or 3 (radio button) - the natural way to test an options panel: is the grid on, is snapping enabled, which export mode is picked. Plain push buttons have no persistent state and always report 0.

When the user toggles the button, it posts a gadget-action event ($401) on the shared event queue with the new state already in EventData, so inside your event handler you often do not need to call ButtonState at all.

To change the state from code use SetButtonState; programmatic changes are silent and post no event.

The world editor shell sample shows buttons wired into the event loop.

See also: SetButtonState, CreateButton, EventData, EventSource.

Index