Page 1 of 1

rawkeydown to scroll with the mousewheel

Posted: Thu Oct 30, 2014 11:10 pm
by jmburnod
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

Re: rawkeydown to scroll with the mousewheel

Posted: Fri Oct 31, 2014 1:43 am
by Simon
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

Re: rawkeydown to scroll with the mousewheel

Posted: Fri Oct 31, 2014 6:04 am
by [-hh]
@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.

Re: rawkeydown to scroll with the mousewheel

Posted: Mon Nov 03, 2014 10:32 am
by jmburnod
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