Page 1 of 1
Scrolling a group with the Mouse Wheel
Posted: Wed Oct 10, 2012 7:30 am
by nacnud
Hi All,
I have been looking for an answer on how to scroll a group with the mouse scroll wheel.
I have a group of elements that is bigger than the card. I can scroll the group using the scroll bar on the left hand side but i have not been able to get it to scroll using the mouse wheel.
I have tried using the rawkeydown command but it only seems to be controlling fields and not the group.
If anyone could help it would be greatly appreciated.
Regards
Chris
Re: Scrolling a group with the Mouse Wheel
Posted: Wed Oct 10, 2012 9:23 am
by bn
Hi Chris,
put this handler into the script of the group that has its lockLoc set to true:
Code: Select all
on rawKeyDown pKey
switch pKey
case 65309
set the vScroll of me to the vScroll of me - 5
break
case 65308
set the vScroll of me to the vScroll of me + 5
break
case 65311
set the hScroll of me to the hScroll of me - 5
break
case 65310
set the hScroll of me to the hScroll of me +5
break
default
pass rawKeyDown
end switch
end rawKeyDown
You don't have to show the vertical/horizontal scrollbars for this to work.
if works on the mac, should also work on windows.
Kind regards
Bernd
Re: Scrolling a group with the Mouse Wheel
Posted: Mon May 25, 2020 4:37 pm
by mrcoollion
This does not work very well on Windows. Some times it does but most of the times it stops scrolling and or does not even react on the mouse wheel.
Re: Scrolling a group with the Mouse Wheel
Posted: Mon May 25, 2020 7:53 pm
by richmond62
And, what happens after I've pressed down on my mouse wheel and then scroll back and forwards a spot?
Err . . . hang about . . . that's odd, something I've not noticed before:
when I scroll the mouse I get 65308 or 65309 . . . so a rawKeyDown signal is received NOT when I press down on the wheel,
but only when I wiggle the thing.
OK . . .so how does the stack know any difference between when I scroll "1 tad" and "2 tads"?
I also wonder why this code in a fieldScript does not work:
Code: Select all
on mouseUp
put the vScroll of me
end mouseUp
Re: Scrolling a group with the Mouse Wheel
Posted: Mon May 25, 2020 8:49 pm
by bogs
Well, I don't pretend to know about the .... ummm... wiggly jiggly question

but as to this -
richmond62 wrote: ↑Mon May 25, 2020 7:53 pm
I also wonder why this code in a fieldScript does not work:
unless the field is locked and transversal is off, you will not see a mouseUp fire in a field, it is ignored.
Re: Scrolling a group with the Mouse Wheel
Posted: Mon May 25, 2020 9:09 pm
by richmond62
Thanks for the heads up!

Re: Scrolling a group with the Mouse Wheel
Posted: Mon May 25, 2020 9:23 pm
by richmond62
Either I've been a bit stupid, or I've merely missed something . . .
-
-
I made a stack 400 x 400, and put a scrolling field on that card with a vertical scroll,
and made that field 440 x 440.
-
-
I can scroll that field with my mouse wheel . . . "just like that" . . . no scripting, "no nothing"
what did I miss?
Re: Scrolling a group with the Mouse Wheel
Posted: Mon May 25, 2020 9:38 pm
by richmond62
Err . . .
how to scroll a group with the mouse scroll wheel
My emphasis.
Re: Scrolling a group with the Mouse Wheel
Posted: Sun Jun 07, 2020 12:53 pm
by mrcoollion
mrcoollion wrote: ↑Mon May 25, 2020 4:37 pm
This does not work very well on Windows. Some times it does but most of the times it stops scrolling and or does not even react on the mouse wheel.
I found a good working answer on my own remark that also works for scrolling a group with the Mouse Wheel. After placing a graphic into the group as its background and size it so that it fills the group scrolling works as expected.
sturgis wrote: ↑Tue Apr 30, 2013 11:16 pm
Also be aware that groups behave strangely with many messages. If you have 3 buttons in your group and move the mouse into the group but don't point at a control, there is no mouseEnter. Once you touch a control the mouseEnter message is sent.
One way around this is to put a graphic into the group as its background and size it so that it fills the group.
Then when you enter the group with the mouse there is always a control there.
Regards,
Paul