07-04-2006 06:55 AM
07-04-2006 07:12 AM
Hello Vincent,
there are two ways to change the active tab page. The first one is using the SetActiveTabPage function. Another method is using SetCtrlAttribute with the ATTR_CTRL_INDEX attribute. There is a slight difference between these two methods. When using SetActiveTabPage, the focus will go to the activated tab, and one of the controls on this tab page will become the active control, receiving keyboard input etc. When using SetCtrlAttribute, the tab page will become visible, but the control that was active before calling the function will still be active after the function is executed.
Success,
Wim
07-05-2006 08:06 AM
07-05-2006 08:26 AM
Sorry Vincent, I have no idea what's causing the problem in the second configuration.
What happens if you replace the code GetActiveTabPage(panel,PNL_TAB,&index); by GetCtrlAttribute(panel,PNL_TAB,ATTR_CTRL_INDEX,&index); ?
07-06-2006 02:45 AM
There is a reason for this behaviour: every time you add a page to the tab control the system is really creating a (child) panel related to that tab page; if you add a breakpoint inside your functions you will see that "panel" variable in OUT button callback has a differemt value from that of IN button callback. Given this, you can use GetActiveTabPage function from the parent panel (the panel the tab control is on) but not from the chile panel (any of the tab pages) since tha panel handle received from Out button is NOT that of the parent panel. Parent panel handle can be retrieved as a panel attribute of the tab page, this way:
GetPanelAttribute (panel, ATTR_PANEL_PARENT, &pH);
GetActiveTabPage (pH, PANEL_TAB, &index);
SetCtrlVal (pH, PANEL_NUMERIC, index);
These lines are to be added to your IN button callback.
07-06-2006 03:18 AM