Page 1 of 1

Mouse events

Posted: Thu Sep 24, 2015 10:02 am
by Joubarbe
Hey,

In Windows, I'm used to have a windowed screen and a loop to check mouse events. I don't use the Mouse library, so I check these events :

#WM_LBUTTONDOWN, #WM_LBUTTONUP, #WM_RBUTTONDOWN, #WM_RBUTTONUP, #WM_MBUTTONDOWN, #WM_MBUTTONUP

And for the mouse wheel : #WM_MOUSEWHEEL, with the following code :

Code: Select all

  Procedure.l MouseWheelDelta()
    Define wz.l
    
    wz = ((EventwParam() >> 16) & $FFFF)
    ProcedureReturn -(wz/100)
  EndProcedure

Code: Select all

    If event = #WM_MOUSEWHEEL
      If MouseWheelDelta() > -100
        scrollUp = 1
      ElseIf MouseWheelDelta() < -100
        scrollDown = 1
      EndIf
    ElseIf scrollUp Or scrollDown
      scrollUp = 0
      scrollDown = 0
    EndIf
Are there any equivalences on Linux for these ?

Re: Mouse events

Posted: Thu Sep 24, 2015 3:08 pm
by Shardik
Have you already taken a look into my cross-platform example code which demonstrates how to detect mouse wheel movement inside a ListIconGadget?

Re: Mouse events

Posted: Thu Sep 24, 2015 3:28 pm
by Joubarbe
Hmm, interesting. There's a #GDK_SCROLL_UP here that gives me hope :) Anyway, you use an EventType, do you know if such an event can also be triggered in a Screen, without gadget ?

The wheel is always a pain to work with ; but in fact, the most important stuff here would be to know how to get mouse "pushed" state. Once I get that, I'll get all I need. But PB doesn't have that natively :(