event of tab items

planB

29-07-2010 10:42:48

hi, every one!

i create a tab, and add some tab items like tab_item1, tab_item2.
what i want to do is that when i clike the tab_item1, the contents of tab_item1 will refrensh, and the same with tab_item2.
so i use the
tab_item1->eventMouseButtonClick=MyGUI::newDelegate(this,&MainState::notifyMouseButtonClick);
tab_item2>eventMouseButtonClick=MyGUI::newDelegate(this,&MainState::notifyMouseButtonClick);

void MainState::notifyMouseButtonClick(MyGUI::Widget* _sender)
{
if (_sender == tab_item1)
{
...........//some code to refresh the contents
}
if (_sender == tab_item2)
{
...........//some code to refresh the contents
}


but it seems that doesn't work.

so what's wrong about this, is the matter with eventMouseButtonClick or the matter with usage of if (_sender == tab_item1)?
can someone help me to solve this, or tell me some other good event to refresh contents of tab items when cilck or active?
thks very much!

Altren

29-07-2010 18:34:26

Use Tab widget event - eventTabChangeSelect. It gives you index of selected tab item.