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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 getnumber command
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

panowski

Poland
5 Posts

Posted - 02/12/2001 :  05:45:04 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
The getn command returns "Command error" if the user cliked Cancel button. This command should return the previous (nonchanged) value of the variable but it doesn't. Is there any way to handle the information that user clicked Cancel?
Thanks!



Edited by - panowski@i on 02/12/2001 06:03:44

Mike Buess

USA
3037 Posts

Posted - 02/12/2001 :  11:25:47 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Run your script from an OGS file and put the getnumber command in a separate section:

[Main]
--other commands--
run.section(,GetValue);
if(cancel==1) type "Cancel";
else type "OK";
--more commands--

[GetValue]
cancel=1;
getn (value) xx (Enter a new value);
cancel=0;

Clicking Cancel in the getnumber dialog will return execution to the [Main] section with the variable 'cancel' set equal to 1. The variable 'xx' will retain its previous value.

-Mike
Go to Top of Page

panowski

Poland
5 Posts

Posted - 02/13/2001 :  07:53:32 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Mike,
but the method you gave doesn't work realy good because:
1. The once clicked Cancel button doesn't close the dialog box
2. The dialog is closed after the second time Cancel button was clicked and no message is given.
Thanks...
Go to Top of Page

greg

USA
1380 Posts

Posted - 02/13/2001 :  4:19:03 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Mike is correct and his method works. You should review it carefully to see how it works.

Clicking Cancel or pressing the Esc key normally generates a Command Error - immediately terminating a script. When executed as a run.section() method called from within an OGS file the behavior is changed slightly: instead of terminating, the script returns to the calling section ([Main]) without completing the called section ([GetValue]). The result is that:

  • Clicking OK or pressing Enter will allow the [GetValue] section to complete (xx will be whatever value the user supplied and cancel will have a value of 0).
  • Clicking Cancel or pressing Esc will 'short-circuit' the [GetValue] section so that xx will be unchanged and Cancel will now have a value of 1 (because cancel=0; never executed) and your calling section will 'know' that the user cancelled.



Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000