LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Missing TAB constant identifier

Hello all,
I think there needs to be an additional #define in the .h file associated to
a .uir.
I have a panel called PNL, which contains a tab control called TAB, which
contains several tabs called T1, T2...
Then I load the panel into the variable hPnl and I want to access the tabs
as panels with
GetPanelHandleFromTabPage (hPnl, PNL_TAB, 0, &pT1)
I must put 0 to specify that I want the 1st panel. This is error prone if
the tab are reodered.
Why isn't there a set of #define
#define T1 0
#define T2 1
....
?
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 1 of 4
(3,269 Views)

The only use for panel constant identifiers is to load the panel with LoadPanel. Once the panel is loaded, you have a panel handle and you never use the panel constant again. This is different than control constants, which you use to identify the control for functions such as SetCtrlVal, etc.

 

Since all the tab panels are loaded automatically when the panel containing the tab control is loaded, there is no reason to provide constant identifiers for tab panels. You still need a way to get the panel handle for the tab panels, which is why GetPanelHandleFromTabPage is provided.

 

If you are worried about tabs being reordered, you could retrieve all the tab panel handles immediately after loading the panel containing the tab control, when you are assured that they are in the same order as saved in the .UIR. If the tabs are subsequently reordered, the panel handles are not changed.

 

Hope this helps,

 

- jared

0 Kudos
Message 2 of 4
(3,253 Views)
> The only use for panel constant identifiers is to load the panel with
> LoadPanel.

I agree, and my use here is almost exactly this: I load them with
GetPanelHandleFromTabPage instead... but I don't have a way to identify
them. If I add a single tab in the middle, I have to go change all the
GetPanelHandleFromTabPage in my code...
--
Guillaume Dargaud
http://www.gdargaud.net/


0 Kudos
Message 3 of 4
(3,208 Views)
I haven't actually tried this, but presumably after using GetPanelHandleFromTabPage() to get the panel handle, you can get the tab panel constant name attribute (ATTR_CONSTANT_NAME) to find out which panel it is (since that name is specified in the UIR editor).
Message Edited by msaxon on 15-06-2010 10:07 AM
--
Martin
Certified CVI Developer
0 Kudos
Message 4 of 4
(3,199 Views)