Space Bar?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
gjn1w07
Posts: 17
Joined: Mon Mar 31, 2008 3:59 pm

Space Bar?

Post by gjn1w07 » Tue Apr 01, 2008 2:22 pm

Hi,

Sorry if this seems to be a simple question - I'm quite new to this!

What is the command to make something happen when someone presses the space bar? I know for instance that for the tab key it's on tabKey, but I can't seem to find the equiviliant for the space bar.

Thanks in advance!

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Post by BvG » Tue Apr 01, 2008 3:39 pm

there is no specific message for the space key, because it's not a modifier key, like shift and the others. You can catch it with the key or rawkey messages, for example:

Code: Select all

on keyUp theKey
  if theKey = space then
    --do stuff here
  end if
end keyUp
if you want to do something while the spacebar is down in some other messag, then this could be one way to do it:

Code: Select all

on mouseUp
  if 65293 is among the items of the keysDown then
    --spacebar is down
  end if
end mouseUp
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

gjn1w07
Posts: 17
Joined: Mon Mar 31, 2008 3:59 pm

Thanks!

Post by gjn1w07 » Wed Apr 02, 2008 9:52 am

Great that's exactly what I needed. Cheers!

Post Reply