LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

another problem about tab

dear sir:
I place two tabs and a button on the main panel,there is a
numeric control on one of the tab,I want to set a value to the numeric
control by the button,but the control can not show the value that I
had set.why ?anyone can tell me?
thanks!
the code :


#include /* Needed if linking in external compiler;
harmless otherwise */
#include
#include "easytab.h"
#include "simpdemo.h"
int panelHandle;

int main (int argc, char *argv[])
{
int tabCtrl;

if (InitCVIRTE (0, argv, 0) == 0) /* Needed if linking in
external compiler; harmless otherwise */
return -1; /* out of memory */

panelHandle = LoadPanel(0, "simpdemo.uir", PANEL);

/* Two function calls and, Voila!, a tab
sheet dialog */
tabCtrl = EasyTab_ConvertFromCanvas(panelHandle, PANEL_CANVAS);
EasyTab_LoadPanels (panelHandle, tabCtrl,1, "simpdemo.uir",
__CVIUserHInst,
CONFIG, 0, HELP, 0, 0);

InstallPopup(panelHandle);
RunUserInterface();

return 0;
}

int CVICALLBACK DoneCallback (int panel, int control, int event, void
*callbackData, int eventData1, int eventData2)
{
if (event == EVENT_COMMIT)
QuitUserInterface(0);
return 0;
}

int CVICALLBACK write(int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
int panelConfig,i;
switch (event)
{
case EVENT_COMMIT:
panelConfig=LoadPanel (PANEL, "simpdemo.uir",CONFIG);
SetCtrlVal (panelConfig, CONFIG_RB, 1);

break;
}
return 0;
}
0 Kudos
Message 1 of 8
(4,409 Views)
Your program is incorrect. In your write callback function you are reloading the panel as a new panel and not displaying it when you call LoadPanel. The panel is already loaded, from the EasyTab_LoadPanels function call. You should be getting a panel handle from that function call and then using it in the function. That would change your EasyTab_LoadPanels call to look like:

EasyTab_LoadPanels (panelHandle, tabCtrl, 1, "simpdemo.uir", __CVIUserHInst,CONFIG, &panelConfig, HELP, &helpPanel, 0);

You would need to define global variables:

static int panelConfig=0;
static int helpPanel=0;

Then remove the local variable panelConfig and the call to LoadPanel in your write callback.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 8
(4,409 Views)
dear Chris Matthews :
thanks a lot,I had solved the problem with your help!
0 Kudos
Message 3 of 8
(4,410 Views)

I am a beginner with CVI. I am about to use data socket functions.

In this process i have browsed NI website and found simple example " transferring an ASCII Text file using Datasocket"

but unfortunately the link ftp://ftp.ni.com/contrib/epd/B45EACE3DEAE56A4E034080020Eu4861/DSFile.zip failed and i could not download DSFile.zip.

Can any one teach me how to transfer a simple text using DS functions (GetDatavalue and SetDatavalue).

Thanks & Regards,

 

0 Kudos
Message 4 of 8
(4,284 Views)

You can find this example code in this page.

Take some moment to browse through the CVI Development Library: it's a good deposit of useful examples to start from in your applications.



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 5 of 8
(4,277 Views)

I'm trying to use the example code, but it keeps giving me linking errors. Does it need any more header files or am I not compiling the code correctly? I appreciate any help. Thanks

0 Kudos
Message 6 of 8
(4,068 Views)
I'm trying to compile the example code, but I keep getting linking errors. Does it need any header files or am I not compiling the files correctly?
0 Kudos
Message 7 of 8
(4,073 Views)
Hi Suraj,

I downloaded the program and also got link errors. Upon further inspection, I realized the project does not have the Datasocket library loaded for you; instead, you must add the library manually. Open the project in CVI and right-click on Instruments in the bottom left. Click Load Instrument and browse to:
CVI\toolslib\datasock\dataskt.fp

Once you have the library added to the project, it should be able to compile without error.

Regards,

0 Kudos
Message 8 of 8
(4,035 Views)