Table of Contents

 
ChangeState
 

Purpose

Changes a button's state

 

Protoype

void CButtonMngr::ChangeState (string str_button, int i_state, bool b_override = false)
 

Parameters

button the ID of the button to affect
state the state to switch the button to
override whether to check (FALSE) if the button actually can change state or not (TRUE)
 

Description

This function changes the state of a button. The ID of the button you want to change is passed in via str_button, and the new state via i_state. Note that the numerical state value must be between 0 and 3, as there are only 4 states that a button can have. By default, the function checks to make sure that a state transition can actually be made (a stuck or disabled button cannot change state without being unstuck or re-enabled for example). I you wish to over-ride this feature and force a state change no matter what, then you can pass TRUE for b_override.

NOTE: Passing a hotspot object to this function will cause the function to do nothing except ignore it and immediately return.

NOTE: It's recommended that you use DisableButton() to change a button's state to disabled rather than this routine, as well as Stick() to change a button's state to stuck.

 

Use

#define STATE_UP 1
CButtonMngr button;
// normal state change
button.ChangeState("my_button", STATE_UP);
// forced state change
button.ChangeState("my_button", STATE_UP, true);
 

Prev: ChangeIcon