LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

In CVI 8.1, I am using tabs. I have nested tabs and I am having difficulty finding the name of a panel for a lower level tab page. How are tab panels (pages) named?

Within CVI all resources are addressed via handles, in case of UIR controls the couple panel handle / control ID. In your case, with tab controls included in a page or another tab control, the crucial point is to retrieve the correct panel handle. The main rule is that every tab page is really a separate panel with its own handle, particularly a child panel of the panel the tab control is in. (BTW, this process can be recursively applied if the parent panel of the tab control is itself a page af a tab control residing on another panel like in your case.  But this has no effect in this discussion)

Now, if you want to address a control located on a page of a tab control, you must get the handle of the "panel" which really is that particular page of the tab control: the handle can be obtained via GetPanelHandleFromTabPage function. As an example, consider you want to set some attribute of the led located on tab0 on the tab control in "Other controls" panel in tabpanels sample shipped with cvi (you can find it in samples\userint folder): these instructions permits you to set the on color of that led to blue:

 GetPanelHandleFromTabPage (gOtherPanel, OTHER_PNL_TAB, 0, &tabpanel);
 SetCtrlAttribute (tabpanel, TABPANEL_LED, ATTR_ON_COLOR, VAL_BLUE);

The trick, as you see, is to start with the correct panel handle.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(3,748 Views)
Thanks.
I had used this function when I dynamically created the tab panels and their controls. When I was trying to reference a control on a different tab panel, I kept getting an error. When debugging, I looked at the panel value in the callback. It was not a value that I expected from the .h file for the UIR. I should have realized that the panel value was being dynamically created and named and was not a static panel name.
0 Kudos
Message 3 of 4
(3,745 Views)
Well, this is a common misunderstansing. The panel name is used throughout a CVI application only when you need to load the panel into memory, and even in this moment is really used as a macro and translated in the include file into an index of the resource within the UIR file. After this moment, all subsequent operations on that resource are routed via the panel handle; this permits also to load the same panel more than once, and address each independent instance of the panel via its unique handle.

Message Edited by Roberto Bozzolo on 06-14-2007 03:39 PM



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 4
(3,741 Views)