Using "ordinary" keys for special actions

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
dsquance
Posts: 40
Joined: Mon Jan 18, 2010 2:47 am

Using "ordinary" keys for special actions

Post 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
bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4219
Joined: Sun Jan 07, 2007 9:12 pm

Re: Using "ordinary" keys for special actions

Post 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
dsquance
Posts: 40
Joined: Mon Jan 18, 2010 2:47 am

Re: Using "ordinary" keys for special actions

Post by dsquance »

Of course. I didn't remember the simple keydown.
Thank you.
Dave
Post Reply