Hi Toralf,
You are correct - Clicking the Cancel button from the InputBox dialog results in run-time error and in termination of program - there is currently no way to catch this.
We have added try-catch in Origin C our internal version and this will be available in the next release version.
For now, you could use LabTalk from within OC and use the LabTalk GetString command, as in the code example posted below:
Easwar
OriginLab.
void test()
{
string strCMD = "flag = 0; getstring (Enter string:); flag = 1;";
LT_execute(strCMD);
string strInput;
double dFlag;
LT_get_var("flag", &dFlag);
if(dFlag)
{
char szTemp[100];
LT_get_str("%B", szTemp, 100);
strInput = szTemp;
printf("You entered: %s\n", strInput);
}
else
{
printf("You hit the Cancel button!\n");
}
}
Edited by - easwar on 06/20/2003 12:19:13 PM
Edited by - easwar on 06/20/2003 12:20:30 PM