03-22-2011 02:19 AM
Hello,
I created a tab sheet with several controls on it. After that I wanted to access the controls on the sheet. In the discussion forum I read that I can get the handle for the control access by calling the function GetPanelHandleFromTabPanel.
But in my version of CVI I was not able to find this function.
Is there a way to implement the function ?
I found a workaround, but it would be easier to use the right function.
Many thanks for your help.
diver
03-22-2011 03:35 AM
Isn't it called
GetPanelHandleFromTabPage?
You might have that function in your library?
03-22-2011 03:55 AM
Hello MacMatze,
thank you for your reply, but I also do not have the function GetPanelHandleFromTabPage in my version of CVI.
regards
diver
03-22-2011 06:02 AM
Hello diver,
5.5 is a very old release for CVI! It surely hasn't the native tab control, which was introduced in release 8 if I'm not wrong. GetPanelHandleFromTabPage is a function inherent to the new tab control that you cannot find in your IDE.
Previous releases (including CVI5.5) used to have the EasyTab instrument, which you could find in <cvidir>\toolslib\custctrl\easytab.fp. Some sample project using this instrument should be located in <cvidir>\samples\userint\custctrl\easytab folder on your hard disk: if you cannot find it re-run the installation of CVI asking to install the collection of sample programs.
The EasyTab instrument has a different loginc for creating and handling tabs: although you can create an EasyTab control from scratch, the easiest way is to place a canvas onto the panel where you want the tab control to be created, then convert the canvas to an easytab; individual tab pages must be designed in the UIR editor as separate panels; they are to be loaded as child panels of the panel the canvas-easytab is in, then you must load then into the EasyTab control. Handles for the tab pages must be saved somewere to permit accessing the controls on them. Looking at the sample program can help you a lot in using the EasyTab instrument.
But I cannot imagine how you could "create a tab sheet with several controls on it" with your version of CVI as it doesn't have the tab control! Could you explain a little better what have you done?
03-22-2011 08:32 AM
Hello Roberto,
I already saw the sample projects provided in the sample directory (simpdemo.prj / tabdemo.prj). This is exactly the way I'm creating my tab sheet containing two tab pages.
You wrote:
"Handles for the tab pages must be saved somewere to permit accessing the controls on them."
And this is my problem. I do not know where to get the handles for the tab pages.
Here's the code from one sample project:
panel = LoadPanel(0, "simpdemo.uir", PANEL);
/* Two function calls and, Voila!, a tab sheet dialog */
tabCtrl = EasyTab_ConvertFromCanvas(panel, PANEL_CANVAS);
EasyTab_LoadPanels (panel, tabCtrl, 1, "simpdemo.uir", __CVIUserHInst, CONTROL, 0, VALVES, 0, MONITOR, 0, CONFIG, 0, HELP, 0, 0);
The handles for the tab sheets are not delivered by calling the functions above and there is no additional function to get the handles from.
03-22-2011 08:59 AM
The correct way of obtaining panel handles, as explained in the help for 'Panel IDs and Handle pointers' parameter, is to pass some pointers to LoadPanels function:
int panelHandle, tab1H, tab2H, tab3H, tab4H, error;
panelHandle = LoadPanel (0, "simpdemo.uir", PANEL);
error = EasyTab_ConvertFromCanvas (panelHandle, PANEL_CANVAS);
error = EasyTab_LoadPanels
(panelHandle, PANEL_CANVAS, 1, "simpdemo.uir", __CVIUserHInst, CONTROL, &tab1H,
VALVES, &tab2H, MONITOR, &tab3H, CONFIG, &tab4H, HELP, 0, 0);
In this case I am getting the handles for the first 4 tabs, leaving the help tab handles unknown. Also, you do not need to save the tab control ID as the function returns the same value associated to PANEL_CANVAS macro, so you may use it everywhere in the program.
I suggest you to add some error checking instead by testing 'error' value after each call.
All these informations are well explained in the online help for the functions that I suggest you to read carefully.
03-22-2011 09:11 AM
Hello Roberto,
I'm sorry. I did not read the help in detail.
Thanks a lot for the time you spent to help me.
Have an nice day.
regards
diver