07-16-2013 02:26 PM
I have two tab controls on my main panel, both are loaded with the same uir which gets the same controls and callback functions.
When I execute the same callback from the different tab controls i get
panel = 4 control = 93 from the 1st tab control and
panel = 13 control = 93 from the 2nd tab control.
This is what I was expecting.
The control is defined in the .h file for the uir as #define LASER_SEED_ENABLE 93
My question is are there define constants that I can use for the panels (4 and 13)?
How does the tab control determine the panel number? Is there an include file or is the panel number determined at runtime?
Solved! Go to Solution.
07-16-2013 02:58 PM
@Paul_Knight_Lockheed_Mart wrote:
My question is are there define constants that I can use for the panels (4 and 13)?
How does the tab control determine the panel number? Is there an include file or is the panel number determined at runtime?
Hi,
you should better not use constants because every time you edit the UI you are at risk that the assignment of control/panel id's is changed. At run time, you can obtain the panel handle of tab panels using
GetPanelHandleFromTabPage ( main_panel_handle, PANEL_TAB, 0, &tabpanel_1_handle );
Note that control ids are not unique, only the combination of panel id / control id is.
In the UI editor, you can use the menu View / Preview User Interface Header File.
Hope it helps.
07-16-2013 03:18 PM
Wolfgang,
That is my worry that the panel numbers will change from 4 and 13 depending on editing the UI. I need to make a decision based on whether the panel is from 1st tab control or the 2nd tab control. I don't want to code if(panel == 4). I want to code something like if(panel == TAB1PANEL). That way if UI is changed, I don't have to change the code.
07-16-2013 03:28 PM
Yes
But why don't you like using GetPanelHandleFromTabPage? It can tell you the tab panel handles for all your tab panels at run time; call it when your program starts up, after loading the UI. You can then use if ( panel == tabpanel_1_handle ) as requested...
07-16-2013 03:37 PM
The values I get from GetPanelHandleFromTabPage are 113930140 and 1600061440. How do they compare with 4 and 13 from the panel variable in the callback function?
07-16-2013 03:40 PM
Does it make any deference that I am using easytab.fp to create the tabs?
07-16-2013 03:45 PM
yes, it does... Sorry, I have assumed you're using the native tab controls. Let me suggest moving your code...
07-16-2013 04:02 PM
I used to do the native code, then I from the easytab. Let me convert it.
07-17-2013 09:04 AM
Wolfgang,
Moving the code back to the native tab controls work.
Thanks for your help.
Paul
07-17-2013 09:29 AM
You're welcome!