Table of Contents

 
ButtonVisible
 

Purpose

Changes the visibility of a button or many buttons

 

Protoype

void CButtonMngr::ButtonVisible (bool b_visible, string str_button, exclude ex_list = exclude(), int i_flag = LIST_IN)
 

Parameters

visible whether to show the button (TRUE) or hide it (FALSE)
button the ID of the button to affect, ALL_BUTTONS if showing/hiding more than one button object
list the list of sprite objects to exclude or include in function
flag whether to exclude objects not in the list (LIST_OUT) or objects in the list (LIST_IN)
 

Description

This function shows or hides a button, or many buttons, depending on how it's used. You must identify the button you want to affect by passing in its ID for str_button, and whether you want to show (TRUE) or hide (FALSE) the button for b_visible.

Showing/Hiding Multiple Objects

If you want to show/hide more than one button object at once, then you can use the last two parameters of the function. First you must compile a list (an STL vector) of objects that you want to either exclude or include. If you want to show/hide all button objects except certain ones, pass those in for ex_list along with the flag LIST_IN. If you want to show/hide only a certain set of objects, pass those in for ex_list along with the flag LIST_OUT. You should also pass ALL_BUTTONS for str_button.

 

Use

CButtonMngr button;
// show one button object
button.ButtonVisible(true, "my_button");
// hide ALL button objects except "my_button"
exclude ex_list;
ex_list.push_back("my_button");
button.ButtonVisible(false, ALL_BUTTONS, ex_list, LIST_IN);
// show ONLY these three button objects
exclude ex_list;
ex_list.push_back("my_button1");
ex_list.push_back("my_button2");
ex_list.push_back("my_button3");
button.ButtonVisible(true, ALL_BUTTONS, ex_list, LIST_OUT);
 

Prev: Assign