PDA

View Full Version : Action attached to the label of a variable


ceuro
05-27-2005, 02:26 AM
Hi, I want to set a value to a variable of a dialog box when the user
clicks on the label of the variable, I don't want to have other dialog like
the option show-input-tool does, the value straight in the field.
Any suggestion ?
Thanks

Andy Poulsen
05-27-2005, 05:55 AM
Hi,

I'm not sure if this is what you're looking for, but the keyword :before-input allows you to execute some code when the user clicks on the variable. For example, in the following code, clicking the label of the variable will set its value to the value of the global variable *my-var*:
(defvar *my-var* 24) ;; define global variable

(sd-defdialog 'my_test
:variables
'((var1 :value-type :integer
:before-input (setq var1 *my-var*))
(var2 :value-type :integer
:after-input (setq *my-var* var2))
))
The second variable shows how to use the :after-input keyword to execute some code after the user has entered the value of a variable. Note that in both the :before-input and :after-input keywords that you can do many other things (including working with additional variables) besides what is shown above.

Does this help?

Good luck!

andy

ceuro
05-27-2005, 06:30 AM
Thanks, it works!!!