LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Tab Control Defines

Solved!
Go to solution

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?

 

0 Kudos
Message 1 of 10
(4,404 Views)

@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.

0 Kudos
Message 2 of 10
(4,400 Views)

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.

 

 

0 Kudos
Message 3 of 10
(4,396 Views)

Yes Smiley Happy

 

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...

 

0 Kudos
Message 4 of 10
(4,392 Views)

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?

0 Kudos
Message 5 of 10
(4,390 Views)

Does it make any deference that I am using easytab.fp to create the tabs?

0 Kudos
Message 6 of 10
(4,388 Views)
Solution
Accepted by topic author Paul_Knight_Lockheed_Mart

yes, it does... Sorry, I have assumed you're using the native tab controls. Let me suggest moving your code...

0 Kudos
Message 7 of 10
(4,386 Views)

I used to do the native code, then I from the easytab.  Let me convert it.

0 Kudos
Message 8 of 10
(4,382 Views)

Wolfgang,

 

Moving the code back to the native tab controls work.

Thanks for your help.

 

Paul

0 Kudos
Message 9 of 10
(4,349 Views)

You're welcome!

0 Kudos
Message 10 of 10
(4,345 Views)