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
 LabTalk Forum
 getnumber command

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
panowski Posted - 02/12/2001 : 05:45:04 AM
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
3   L A T E S T    R E P L I E S    (Newest First)
greg Posted - 02/13/2001 : 4:19:03 PM
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.



panowski Posted - 02/13/2001 : 07:53:32 AM
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...
Mike Buess Posted - 02/12/2001 : 11:25:47 AM
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

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