Scrolling with keys

Scott Rossi scott at tactilemedia.com
Mon Jun 23 15:24:00 EDT 2003


Recently, "Ken Norris"  wrote:

> So, how would I scroll an image with a keypress while it's down, then stop
> on keyup.

Either place the image in a group, lock the group (so it doesn't resize) and
give it a scrollbar, or set the imageSource of a character in a scrolling
field.

One basic way to manage the scroll is to use the keyDown (or rawKeyDown)
message to set the scroll of the object:

on rawKeyDown K
  # THIS USES UP/DOWN ARROW KEYS TO MANAGE GROUP SCROLLING
  # 5 IS AN ARBITRARY SCROLL VALUE;
  # USE WHATEVER WORKS IN YOUR SITUATION
  #
  # INCREASE SCROLL
  if K = 65364 then set the vScroll of group 1 to the vScroll of group 1 + 5
  # DECREASE SCROLL
  if K = 65362 then set the vScroll of group 1 to the vScroll of group 1 - 5
end rawKeyDown


Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com




More information about the use-livecode mailing list