rawkeydown to scroll with the mousewheel

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

rawkeydown to scroll with the mousewheel

Post by jmburnod » Thu Oct 30, 2014 11:10 pm

Hi All,

I use this script to scroll a group with the mousewheel.
It works perfectly on OSX but not on Windows.
What I forget ?

Code: Select all

on rawkeydown pRawKey
   put "grPresentation" into sCurScroll
   put "65309,65308" into tLesK
   if pRawKey = 65309 or pRawKey = 65308  then
      put 72 into tEmpan
      if sCurScroll <> empty then
         if the mouseloc is within the rect of group sCurScroll then
            if pRawKey = 65308 then
               put tEmpan into tSec
            end if
            if pRawKey = 65309 then
               put (0-tEmpan) into tSec
            end if
            set the vscroll of group sCurScroll to (the vscroll of group sCurScroll) + tSec
         end if
      end if
   else
      pass rawkeydown
   end if
end rawkeydown
Best regards
Jean-Marc
https://alternatic.ch

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: rawkeydown to scroll with the mousewheel

Post by Simon » Fri Oct 31, 2014 1:43 am

Hi Jean-Marc,
I use this:

Code: Select all

on rawKeyDown pKey
   switch pKey
      case 65309
         set the vScroll of me to the vScroll of me - 30
         break
      case 65308
         set the vScroll of me to the vScroll of me + 30
         break
      case 65311
         set the hScroll of me to the hScroll of me - 30
         break
      case 65310
         set the hScroll of me to the hScroll of me +30
         break
      default
         pass rawKeyDown
   end switch
end rawKeyDown
in the group script.
works mac/win mouseWheel and Trackpad

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: rawkeydown to scroll with the mousewheel

Post by [-hh] » Fri Oct 31, 2014 6:04 am

@Simon.
Some apps use vertical scrollWheel (65309 and 63308) if *the shiftkey is down* also for setting the hscroll instead of vscroll, especially if no trackpad is present. This could 'somehow' complete also your script, isn't it?

@Jean-Marc.
The difference in Mac vs. Win behaviour must come from
"the mouseloc is within the rect of group sCurScroll".
I had such differences too whenever the mouse was over the scrollbar of the group and it worked when subtracting the scrollbarWidth from the group's width.
shiftLock happens

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: rawkeydown to scroll with the mousewheel

Post by jmburnod » Mon Nov 03, 2014 10:32 am

Hi Both,
Sorry. I was wrong in my explanation
The problem is not with the mousewheel but with the trackpad on windows only

@Simon
Your script works perfectly and it is clearer and simpler than mine.
I understand I have made so complicated because I wanted a stack script for all groups. I think give up it

@Hermann
"the mouseloc is within the rect of group sCurScroll" seems not a problem.
It is just not useful if I give up stack script
it worked when subtracting the scrollbarWidth from the group's width
Then the scrollbar is not visible. Right ?

This script is one of EcrireEnPicto that I'm cleaning for a new version (OSX, Windows, IOS.)

Thanks one more for your help

P.S. Since 2007, the english dialecte from swiss western seems allowed in this forum :D
https://alternatic.ch

Post Reply

Return to “Windows”