08-31-2007 03:12 AM
08-31-2007 03:27 AM
08-31-2007 04:08 AM
In order to address controls on a tab page you must firstly get the correct handle of the tab page itself, which acts as a child panel of the panel the tab control is in. To obtain that handle you can use GetPanelHandleFromTabPage function, passing the index of the specific page you need to operate on.
Sorry to answer in englsh: I cannot speak french. I take this opportunity to inform you that a french-speaking board exists inside NI forums: you can find it here.
08-31-2007 07:26 AM
08-31-2007 08:21 AM
I never have used Delphi so I cannot compare these two environments... it is also possible that the deeper knowledge in Delphi makes it easier for you to use its instruments than those of other languages
Just to clarify some concept, prior to version 8 tab controls were implemented in CVI with the EasyTab control which, if more difficult while designing the user interface (some trial-and-error process was needed to accomodate the final aspect of the tab control within the panel) made it clearer that tab pages are in every aspect independent entities (child panels of the panel the tab control was in) .
With that instrument, the process of creating a tab control within a panel was:
1. Create the area where the tab control should appear (converting a canvas or creating from scratch)
2. Loading (child) panels: each of them has its own handle used to address controls on it
3. Adding panels to the tab control
I suppose the new tab control included in CVI8 is an evolution of this procedure, which hides the process of adding panels and simplifies the design of the user interface. In my opinion, nevertheless, it makes more obscure what really are tab panels and how to address controls on them. You always need to consider that a tab page is actually an independent panel and addressing controls on it must be done via its proper handle. Look at this sample callback which you can find in TabExample.prj (which ships with CVI): as you can see, addressing controls to retrieve and write values is preceded by GetPanelHandleFromTabPage function in order to retrieve the correct handle to the tab page panel.
int CVICALLBACK KnobCB (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
double knobValue;
switch (event)
{
case EVENT_VAL_CHANGED:
GetPanelHandleFromTabPage (panelHandle, PANEL_TAB, PAGE_TWO, &TabPanelHandle);
GetCtrlVal (TabPanelHandle, TABPANEL_2_NUMERICKNOB, &knobValue);
SetCtrlVal (TabPanelHandle, TABPANEL_2_NUMERICTANK, knobValue);
break;
}
return 0;
}
08-31-2007 08:41 AM
I don't have the new CVI8 tab features but does not the first parameter to the control callback already contain the correct tab/panel handle? That is, assuming the control manipulations are all on the same tab, of course.
JR
08-31-2007 08:55 AM
Yes, you're right: in that piece of code retrieving the tab panel handle is redundant (I suppose it has been added to show the usage of that function).
In any case you do need to retrieve the correct handle if you are operating on a panel different from the tab page and you want to display results / retrieve values with controls on the tab control.
08-31-2007 09:22 AM