Rawkeydown and the mouse wheel

Howard Bornstein howard.bornstein at gmail.com
Thu Sep 27 17:21:41 EDT 2007


I'm trying to use the mouse wheel to scroll a group in a stack using the
rawkeydown handler. I've seen Mark Waddingham's comments that groups don't
respond to key messages:

"I think this is a consequence of mouse-wheel messages being sent as key's
at present and groups not responding to any key messages at the moment."

However, it seems like it should be easy to get around this by simply
putting the rawkeydown handler in the stack script and pointing it at the
group scroll values when it detects the mousewheel codes.

Alas, something odd is happening with all this.

I set up a group with a few buttons and sized it so that scroll bars
appeared when I turned them on.

I put the following handler in the stack script.

on rawkeydown keystroke
  put the vscroll of group 1 into vs
  if keystroke is 65308 then
    set the vscroll of group 1 to vs - 10
  else if keystroke is 65309 then
    set the vscroll of group 1 to vs + 10
  end if
  put keystroke
  pass rawkeydown
end rawkeydown

Anything I type, no matter where the cursor is, gets echoed in the message
box, as is expected. However, if I scroll the mouse wheel, it only works
under the following conditions:

1) if the cursor is directly over one of the buttons in the group. (if it's
over white space within the group, scrolling doesn't happen)
2) if the cursor is over any other object outside the group (i.e. if there's
a button or field or image outside the group and the cursor is over it)

However, if the cursor is just over the card with nothing under it, the
mouse wheel "key" messages apparently are not sent.

This is very strange. Typing a key, no matter where the cursor is, gets
echoed properly, meaning the rawkeydown handler is getting the key strokes.
However, it only gets the mouse wheel "key" message when the cursor is over
an object. How come the rawkeydown handler isn't getting the mouse wheel
input when the cursor isn't over an object?

Aside from putting a giant invisible button behind my entire stack (which is
impractical for my current application) does anyone know of any other means
to make the rawkeydown handler see the mouse wheel messages all the time?

-- 

Regards,

Howard Bornstein
-----------------------
www.designeq.com



More information about the use-livecode mailing list