Scrolling a group with the Mouse Wheel
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Scrolling a group with the Mouse Wheel
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
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
Hi Chris,
put this handler into the script of the group that has its lockLoc set to true:
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
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
if works on the mac, should also work on windows.
Kind regards
Bernd
-
- Posts: 738
- Joined: Thu Sep 11, 2014 1:49 pm
Re: Scrolling a group with the Mouse Wheel
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.
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Scrolling a group with the Mouse Wheel
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:
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
Well, I don't pretend to know about the .... ummm... wiggly jiggly question
but as to this -

unless the field is locked and transversal is off, you will not see a mouseUp fire in a field, it is ignored.richmond62 wrote: ↑Mon May 25, 2020 7:53 pmI also wonder why this code in a fieldScript does not work:

-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Scrolling a group with the Mouse Wheel
Thanks for the heads up! 

-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Scrolling a group with the Mouse Wheel
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?
- -
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?
- Attachments
-
- Scroller Ball.livecode.zip
- Here's the stack.
- (1.02 KiB) Downloaded 227 times
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Scrolling a group with the Mouse Wheel
Err . . .
My emphasis.how to scroll a group with the mouse scroll wheel
-
- Posts: 738
- Joined: Thu Sep 11, 2014 1:49 pm
Re: Scrolling a group with 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.mrcoollion wrote: ↑Mon May 25, 2020 4:37 pmThis 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.
sturgis wrote: ↑Tue Apr 30, 2013 11:16 pmAlso 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