Table of Contents

 
ShowIcon
 

Purpose

Shows or hides a button's icon

 

Protoype

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

Parameters

visible whether to make the icon image visible (TRUE) or hidden (FALSE)
button the ID of the button to affect, ALL_BUTTONS if affecting 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 controls the visibility of icons on a button. like captions, icons can be made visible or hidden for various purposes. If you want to show a button's icons, you pass in the ID of the button for str_button along with TRUE for b_visible. If you want to hide the icon then you would pass FALSE for b_visible instead.

Affecting Multiple Objects

If you want to affect 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 affect all button objects except certain ones, pass those in for ex_list along with the flag LIST_IN. If you want to affect 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 icon
button.ShowIcon(true, "my_button");
// hide ALL icons except "my_button"
exclude ex_list;
ex_list.push_back("my_button");
button.ShowIcon(false, ALL_BUTTONS, ex_list, LIST_IN);
// show ONLY these three icons
exclude ex_list;
ex_list.push_back("my_button1");
ex_list.push_back("my_button2");
ex_list.push_back("my_button3");
button.ShowIcon(true, ALL_BUTTONS, ex_list, LIST_OUT);
 

Prev: ShowHotSpots
Next: Stick