Mouse, scroll wheel support?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Mouse, scroll wheel support?

John Youngquist-2
Is there a non Lazarus means of accessing the mouse, and scroll wheel?
I have an app that uses some old driver which doesn't address the wheel.
I'm trying to make the wheel work. I have tried SDL and the demo code works
but it seems to work only in an externally created window. I can't find any
documentation for it nor can I post on the forum.

Thanks    JY
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Mouse, scroll wheel support?

Michalis Kamburelis-3
2016-06-28 15:05 GMT+02:00 John Youngquist <[hidden email]>:
> Is there a non Lazarus means of accessing the mouse, and scroll wheel?
> I have an app that uses some old driver which doesn't address the wheel.
> I'm trying to make the wheel work. I have tried SDL and the demo code works
> but it seems to work only in an externally created window. I can't find any
> documentation for it nor can I post on the forum.
>

Accessing events like mouse and keyboard always requires to use some
API. It may be high-level API like Lazarus LCL or SDL (or my
TCastleWindow), it may be lower-level like GTK, or WinAPI, or even
Xlib. For all these APIs, the exact answer "how to read mouse wheel
events" is different:)

In most of them, you can only read mouse events that reach windows
that you yourself created (windows for which you have a "handle" or
some equivalent). If you want to get mouse wheel events that occur
above *any* window --- you may be out of luck (or you may be able to
use some hack in the lowest-level APIs, like WinAPI or Xlib, but I
can't help you more here).

For SDL, the way to read mouse wheel is to

- either use https://wiki.libsdl.org/SDL_MouseWheelEvent (but it seems
SDL_MOUSEWHEEL is not translated in FPC SDL headers, neither in
original jedi-sdl headers),

- or you can watch for event types SDL_MOUSEBUTTONDOWN ,
SDL_MOUSEBUTTONUP with button set to SDL_BUTTON_WHEELUP or
SDL_BUTTON_WHEELDOWN (this works without problems for me, trying on
old jedi-sdl examples with FPC SDL units).

Regards,
Michalis
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Mouse, scroll wheel support?

Tomas Hajny-2
On Wed, June 29, 2016 11:04, Michalis Kamburelis wrote:
> 2016-06-28 15:05 GMT+02:00 John Youngquist <[hidden email]>:


Hello,

Apparently, the original poster forgot to mention that he wasn't
subscribed to the list and thus he might not see responses to his question
- adding him in Cc: of the response below now...

Tomas


>> Is there a non Lazarus means of accessing the mouse, and scroll wheel?
>> I have an app that uses some old driver which doesn't address the wheel.
>> I'm trying to make the wheel work. I have tried SDL and the demo code
>> works but it seems to work only in an externally created window. I can't
>> find any documentation for it nor can I post on the forum.
>>
>
> Accessing events like mouse and keyboard always requires to use some
> API. It may be high-level API like Lazarus LCL or SDL (or my
> TCastleWindow), it may be lower-level like GTK, or WinAPI, or even
> Xlib. For all these APIs, the exact answer "how to read mouse wheel
> events" is different:)
>
> In most of them, you can only read mouse events that reach windows
> that you yourself created (windows for which you have a "handle" or
> some equivalent). If you want to get mouse wheel events that occur
> above *any* window --- you may be out of luck (or you may be able to
> use some hack in the lowest-level APIs, like WinAPI or Xlib, but I
> can't help you more here).
>
> For SDL, the way to read mouse wheel is to
>
> - either use https://wiki.libsdl.org/SDL_MouseWheelEvent (but it seems
> SDL_MOUSEWHEEL is not translated in FPC SDL headers, neither in
> original jedi-sdl headers),
>
> - or you can watch for event types SDL_MOUSEBUTTONDOWN ,
> SDL_MOUSEBUTTONUP with button set to SDL_BUTTON_WHEELUP or
> SDL_BUTTON_WHEELDOWN (this works without problems for me, trying on
> old jedi-sdl examples with FPC SDL units).
>
> Regards,
> Michalis


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal