Page 1 of 1

Using "ordinary" keys for special actions

Posted: Tue Mar 15, 2011 10:48 pm
by dsquance
I want to be able to perform an action with the contents of a field by pressing the negative sign, just as can be done with the enter key or return key. Is this possible, and if so, what is used to call the action.
Thanks.
Dave

Re: Using "ordinary" keys for special actions

Posted: Tue Mar 15, 2011 11:00 pm
by bn
Hi dsquance,

if you mean you are editing a field and then type "-" then this code does some action. Put it into the script of the field you want to edit.

Code: Select all

on keyDown theKey
   if theKey is "-" then 
     -- or a more meaningful action here
     set the textsize of me to random (22-14 +1) + 14-1
   else
      pass keyDown
   end if
end keyDown
Kind regards

Bernd

Re: Using "ordinary" keys for special actions

Posted: Wed Mar 16, 2011 2:26 am
by dsquance
Of course. I didn't remember the simple keydown.
Thank you.
Dave