The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 InputBox cancel

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
AG_Kraemer Posted - 06/20/2003 : 10:38:14 AM
Edit: I meant the InputBox, not the progressbox

Hello,

I am a bit unhappy that the programm stops immediately once the cancel button in a progressbox is pressed. I would like to clean up a few thing which have been generated by the function up to this point. So, how do I intercept this? It appears there is no integer result returned by the progressbox procedure (e.g. messagebox--> IDNO=7). So how do I do this?

Toralf

Edited by - AG_Kraemer on 06/20/2003 10:48:28 AM

Edited by - AG_Kraemer on 06/20/2003 11:01:09 AM
4   L A T E S T    R E P L I E S    (Newest First)
AG_Kraemer Posted - 06/23/2003 : 03:01:35 AM
Hi easwar,

Thanks again for your quick reply! I have thought about the Labtalk detour. But as I try to keep the C-file as Labtalk free as possible I was hoping I have just overlooked the proper use of the inputbox - thanks for enlightening me!

Regards,
Toralf
easwar Posted - 06/20/2003 : 12:02:23 PM
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
AG_Kraemer Posted - 06/20/2003 : 10:59:54 AM
Thanks for your response! But I asked the wrong question: Not the cancel button of the progressbox was my problem but the the Cancel Button in the InputBox:

repeatstr = InputBox("How many repetitions...)

Regards,
Toralf
easwar Posted - 06/20/2003 : 10:53:53 AM
Hi Toralf,

You could do something like in the code pasted below...

Easwar
OriginLab.



void pbTest()
{

progressBox pBox("Computing...hit Esc to stop.");
pBox.SetRange(0,100);
pBox.Set(0);

// Loop over steps - performing your computation
for(int ii = 0; ii <= 100; ii++)
{
// just wait a while on each step
LT_execute("sec -p 0.1");

// Check if user hit Cancel key by updating progress box
if(!pBox.Set(ii))
{
printf("Computation terminated at step %d!\n", ii);
break;
}
}
}



The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000