Blitz3D+ Command Reference

SetButtonState button,state

Parameters

button - button gadget

state - 1 checks the button, 0 unchecks it

Description

Checks or unchecks a checkbox or radio button.

Requires Extended language mode.

Meant for buttons created with CreateButton style 2 (checkbox) or 3 (radio button) - use it to load saved options into a settings panel, or to keep a checkbox in sync with a menu item. Plain push buttons have no check state, so it does nothing visible on them.

Setting the state from code is silent: no $401 event is posted. When the user clicks, the button does post $401, with the new state in EventData. Read the current state at any time with ButtonState.

Radio gotcha: when the user clicks a radio button, Windows unchecks the others in the group automatically - but SetButtonState changes only the one button you name. Setting a radio group from code means checking one and unchecking the rest yourself.

See also: ButtonState, CreateButton, CheckMenu.

Index