Scroll wheel behavior and rawkeyUp

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Scroll wheel behavior and rawkeyUp

Post by jmburnod » Tue Apr 17, 2012 6:53 pm

Hi All,

Is there a way to have an equivalent of rawkeyUp for 65309 and 65308 (the mousewheel) ?
User contributed notes from dictionary
use the rawKeyDown handler instead of this one as the scroll wheel does not generate rawKeyUp messages.
Best regards

Jean-Marc
https://alternatic.ch

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: Scroll wheel behavior and rawkeyUp

Post by dunbarx » Tue Apr 17, 2012 7:03 pm

Jean-Marc.

What do you mean? This?

Code: Select all

on mouseup
   send "rawkeydown 65309" to this cd
end mouseup
Where in the card script:

Code: Select all

on rawkeydown tKey
   put random(99)
end rawkeydown
So when you scroll the wheel you get a bunch of random numbers , and when you click the button that contains the first script you get another. What do you want to do?

Craig Newman

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Scroll wheel behavior and rawkeyUp

Post by mwieder » Tue Apr 17, 2012 7:11 pm

Like the user note says, use the rawKeyDown message to handle it:

Code: Select all

on rawKeyDown pKeyCode
    local tIncrement
    local tScroll

    -- wheel up,down,left,right
    if pKeyCode is among the items of 65308,65309 then
        put trunc(0.10 * the height of me) into tIncrement
        switch pKeyCode
            case 65308 
                put the scroll of me into tScroll
                add tIncrement to tScroll
                set the scroll of me to tScroll
                break
            case 65309 
                put the scroll of me into tScroll
                subtract tIncrement from tScroll
                set the scroll of me to tScroll
                break
        end switch
        exit rawKeyDown
    end if
    pass rawKeyDown
end rawKeyDown

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Scroll wheel behavior and rawkeyUp

Post by jmburnod » Tue Apr 17, 2012 9:47 pm

Hi,
Thanks for reply.

Sorry my explanation is not clear. the mousewheel work fine but i need to catch the end of the rawkeyDown message to adjust the vscroll (when it stop between 2 images).

I have found a temporary way with a mouseleave on the script of the control

Best regards

Jean-Marc
https://alternatic.ch

Post Reply