jpsheader.jpg (29354 bytes)

Back to DCL Tutorial Homepage

Back to AutoLisp Homepage

Back to JefferyPSanders.com

 

 

 

The AutoLisp Tutorial - DCL

Dialog Control Language - Action


   Action


    In order for the dialog box to respond to user interaction, you must set up an action event.  A trigger, to fire when the user selects an item from a list or presses a button.  This works off of the KEY defined for each control inside the DCL file.  If the key for a button is named "mybutton" then you must have an action named "mybutton".  Otherwise the user will press the button and nothing will happen.  Let's take a look at the action_tile.

(action_tile  "key"   "action")

   The action_tile has two parameters.  "Key" and "action".

   "Key" - The name of the key you defined with the control inside the DCL file.

   "Action"- The action you want taken when the action event is fired.  You can set a variable or run a function.


  Examples:

  Let's take for example, you have a button named "test" and you want to set the variable named myTEST to 1 if the user presses the button:

(action_tile  "test"  "(setq myTest 1)")

  Notice the key is in quotes and the setq function is in quotes.  This is standard procedure for the action_tile statement.  Next let's say you have the same thing except you want to run a function named "saveVars" when the user presses the test button.

(action_tile  "test"   "(saveVars)")

Notice is is the same as the above.  The (saveVars) is inside quotes.

What if you wanted to do both, run the function and set a variable?

(action_tile  "test"  "(setq myTest 1)(saveVars)")

Simply put both inside the quotes. 

One more thing....What if the button is set to be the cancel or accept button for the dialog box?  No problem...

(action_tile  "test"  "(setq myTest 1)(saveVars)(done_dialog 1)")

  Add the done_dialog statement to the end.  [ Inside the quotes ]


  That is about all there is to an action_tile.  Remember, anything with a key can have an action call.

Back


AutoLisp DCL Tutorial Home

AutoLisp Home

Home

All questions/complaints/suggestions should be sent to JefferyPSanders.com

Last Updated April 1st, 2013

Copyright 2002-2013 JefferyPSanders.com. All rights reserved.