LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Easytab: how to reset the content?

How do I clear the card's content for the next time the Easytab is opened? I tred to use ResetTexBox, but I am getting an error -74 (not a text box).
0 Kudos
Message 1 of 7
(3,851 Views)
What do you mean by "clear the card's content"?
What do you mean by "the next time the Easytab is opened"?
What ControlID did you pass to ResetTextBox? It needs to be a text box, not an EasyTab control.

If you mean that you want all controls on a tab to return to a default whenever you select that tab, you need a callback function on the EasyTab control. If you used EasyTab_ConvertFromCanvas to create the EasyTab, create a callback for the canvas, then check for EVENT_TAB_CHANGED (defined in easytab.h). In the UI editor, edit the canvas control and enter a callback function name, e.g. cbfnCanvas, then generate and edit the callback.


int CVICALLBACK cbfnCanvas (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (
event)
{
case EVENT_TAB_CHANGED:
// do a SetCtrlVal or ResetTextBox
// individually on each control
// on the tab to set the desired default

break;
}
return 0;
}
0 Kudos
Message 2 of 7
(3,851 Views)
The problem is that each time I show the easy tab, I refetch the data for it (which I keep in a ini file). So if I show and hide the easytab 5 times, I get 5 copies of the text from the content. I want to blank out the content of the card each time before I repopulate it. Unless there is a better way?
0 Kudos
Message 3 of 7
(3,851 Views)
What is a "card"? Does it have multiple controls on it?

If you want to blank a text box, use ResetTextBox(). Make sure the panel handle is for a panel loaded into the tab control by EasyTab_LoadPanels(), not the panel on which the tab control was created. Make sure you have the Control ID properly specified in the PANEL_CONTROL format.

Have you looked at using SavePanelState() and RecallPanelState()? They work with all controls on a panel with a single command.
0 Kudos
Message 4 of 7
(3,851 Views)
Here is where I convert the canvases:

//make tabs
iEasyTab = EasyTab_ConvertFromCanvas (panelStonePop, PANELUI_CANVAS);

iRc=EasyTab_LoadPanels (panelStonePop, iEasyTab, 1, "stonepop.uir",__CVIUserHInst,PANEL1, &easytab1, PANEL2, &easytab2, PANEL3, &easytab3, PANEL4, &easytab4, PANEL5, &easytab5, 0);

And here is where I try to blank out the content on each of the 5 cards. I think of the easytabs as index cards. That is what I mean by "card". Here it is:

iRc=ResetTextBox (panelStonePop, PANEL1_TEXTBOX, "");
iRc=ResetTextBox (panelStonePop, PANEL2_TEXTBOX, "");
iRc=ResetTextBox (panelStonePop, PANEL3_TEXTBOX, "");
iRc=ResetTextBox (panelStonePop, PANEL4_TEXTBOX, "");
iRc=ResetTextBox (panelStonePop, PANEL5_TEXTBOX, "");


What should my ResetTexBox say to blank out a card?
0 Kudos
Message 5 of 7
(3,851 Views)
You will have to empty each textbox control on each tab panel (card). The problem with the code you have above is the you are using the panelStonePop panel handle, which is your main panel, not the tab panels. You would want to use the panel handles for the tab panels that are returned to you by the EasyTab_LoadPanels function. So you code would be:

iRc=ResetTextBox (easytab1, PANEL1_TEXTBOX, "");
iRc=ResetTextBox (easytab2, PANEL2_TEXTBOX, "");
iRc=ResetTextBox (easytab3, PANEL3_TEXTBOX, "");
iRc=ResetTextBox (easytab4, PANEL4_TEXTBOX, "");
iRc=ResetTextBox (easytab5, PANEL5_TEXTBOX, "");

That would clear the texbox control with a constant of TEXTBOX on each of the tab panels.

Best Regards,

Chris Matthews

National Instruments
0 Kudos
Message 6 of 7
(3,851 Views)
That's what I meant when I said "Make sure the panel handle is for a panel loaded into the tab control by EasyTab_LoadPanels(), not the panel on which the tab control was created."

In your code, panelStonePop is the panel on which the tab control was created. easytab1 through easytab5 are the panels loaded into the tab control. Your textboxes are on the easytab1 through easytab5 panels, not on the panelStonePop panel.
0 Kudos
Message 7 of 7
(3,851 Views)