LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

textbox

Hello, a bit new to labwindows and im having some trouble simpling printing anything to a textbox. It gives me an error. 

NON-FATAL RUN-TIME ERROR: "gcm4.c", line 113, col 9, thread id 0x00000F68: Library function error (return value == -13 [0xfffffff3]). Invalid control ID

 

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

//printf("hello world\n");

if ((handle = LoadPanel (0, "GUI.uir", 1)) < 0)
return -1;


DisplayPanel (handle);
RunUserInterface ();
DiscardPanel (handle);
CloseCVIRTE ();

return 0;
}

int CVICALLBACK AddCallback (int panel, int control, int event,
void *callbackData, int eventData1,
int eventData2)
{
char str[100];

if (event == EVENT_COMMIT)
{
g_lineCount++;
if (g_lineCount > 1)
Fmt (str, "%s<%s%d%s", "This is line at index ", g_lineCount - 1,
" added to the end of the existing text\n");
else
Fmt (str, "%s<%s", "This is the first line added to the box\n");

/* setting the value of the Textbox will insert a line at the end... */
SetCtrlVal (panel, PANEL_ACTIONBOX, str);
}
return 0;
}

0 Kudos
Message 1 of 3
(2,751 Views)

Okay when i compiled i thought the uir header file was automatically included but i just had to manual add it in.

0 Kudos
Message 2 of 3
(2,738 Views)

It should have added the missing include!

Did you manually created the project and the code? If you use code auto-generation CVI creates by itself the project including all necessary files (adding InitCVIRTE at the beginning of main, which is missing in your code, and not putting CloseCVIRTE at the end, which you have).

 

Since you are new to CVI maybe a fast read to Getting Started manual would be helpful. In any case, the recommended way to start a new project is to desig at least the main panel and then create the project and make the IDE create code framework: this guarantees that at least at project start all goes well. See chapter 2, item 2-6 which explains code auto-generation via CodeBuilder facility.



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 3 of 3
(2,731 Views)