Table of Contents

 
MoveButton
 

Purpose

Moves a button to a new location relative from its old one

 

Protoype

void CButtonMngr::MoveButton (int i_xchange, int i_ychange, string str_button, exclude ex_list = exclude(), 
                              int i_flag = LIST_IN)
 

Parameters

xchange the change in X position
ychange the change in Y position
button the ID of the button to move, ALL_BUTTONS if moving more than one button object
list the list of button 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 moves buttons relative from their current position. So if a button object is at (100, 200) and you pass in i_xchange and i_ychange values of 20 and 40, the new location of the button object will be (120, 240).

Moving Multiple Objects

If you want to move more than one button object at once the same distance, 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 move all button objects except certain ones, pass those in for ex_list along with the flag LIST_IN. If you want to move 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;
// move one button object
button.MoveButton(5, 5, "my_button");
// move ALL button objects except "my_button"
exclude ex_list;
ex_list.push_back("my_button");
button.MoveButton(5, 5, ALL_BUTTONS, ex_list, LIST_IN);
// move 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.MoveButton(5, 5, ALL_BUTTONS, ex_list, LIST_OUT);
 

Prev: LoadButtons