michaelk Posted December 22, 2011 Share Posted December 22, 2011 What's the best way to handle a "Cancel" in a dialog box? I'd like the script stop running if cancel is chosen. My current dialog handler looks something like this: PROCEDURE Dialog_Handler(VAR item :LONGINT; data :LONGINT); BEGIN CASE item OF SetupDialogC: BEGIN Set Stuff.... END; 1: BEGIN Get Stuff..... END; END; END; Is it as simple as 0: ______________(Some command that means stop); Thanks! mk Quote Link to comment
Vectorworks, Inc Employee klinzey Posted December 22, 2011 Vectorworks, Inc Employee Share Posted December 22, 2011 2: would be the event of the "Cancel" Button but you really want to check the return value from RunLayoutDialog call outside of the dialog handler. If it's not 1 then the user canceled or closed the dialog without hitting the OK button. There are typically 3 default IDs used by the dialog. 1: OK Button 2: Cancel Button 3: Help Box so your first control should be 4. Quote Link to comment
michaelk Posted December 22, 2011 Author Share Posted December 22, 2011 Thanks, Kevin. Is there a command (other than goto) that will skip the rest of the code? MK Quote Link to comment
Vectorworks, Inc Employee klinzey Posted December 22, 2011 Vectorworks, Inc Employee Share Posted December 22, 2011 No. GoTo is just about it. In reality you should structure the code so that is is in an If Then Else statement after the dialog is finished. If RunLayoutDialog = 1 then Do Stuff else Do Nothing Quote Link to comment
michaelk Posted December 22, 2011 Author Share Posted December 22, 2011 Does the first argument of the dialog handler retain its value outside the dialog handler? mk Quote Link to comment
Vectorworks, Inc Employee klinzey Posted December 22, 2011 Vectorworks, Inc Employee Share Posted December 22, 2011 No, It's only valid inside the dialog handler. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.