Until Originlab provide an Origin C version of the GetNumber function in labtalk, it is quite combersome to call this labtalk function from Origin C, but I have provided an example here. You will need to put the following code in a file called test.c and put this file inside the Origin C folder.
void dd(string str, double xmin, int i, int j, int k)
{
LT_set_str("%A", str);
LT_set_var("i",i);
LT_set_var("j",j);
LT_set_var("k",k);
LT_set_var("MyVar", xmin);
printf("On input, Xmin=%f, i=%d, j=%d, k=%d, str=%s\n", xmin, i,j,k,str);
// can use __FILE__ to find this file name, but
// we will just hard code it here to be a file called test.c inside
// OriginC subfolder
if(!LT_execute("run.section(%YOriginC\\test.c,GetNum)"))
{
out_str("User Cancel");
return;
}
double db_i, db_j, db_k;
LT_get_var("MyVar", &xmin);
LT_get_var("i",&db_i); // must use double to receive value from labtalk
LT_get_var("j",&db_j);
LT_get_var("k",&db_k);
char szTemp[100];
LT_get_str("%A", szTemp, 100);
printf("On output, Xmin=%f, i=%d, j=%d, k=%d, str=%s\n", xmin, (int)db_i,(int)db_j,(int)db_k,szTemp);
}
// this is a trick to call LabTalk section inside a C file
#ifdef _JUNK
// section name must match run.section
[GetNum]
%B = "line1 line2 line3"; // drop down list with three entries
getn
(X Minimum) MyVar
(my boolean) k:2s
(my list) i:B
(Color) j:@C
(Your Name) %%A
(Title of this dialog);
return 0;
#endif //_JUNK
You can then compile this and type into script window
dd "some text" 5.7 1 1 1;
CP