Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-06

Mouse, scroll wheel support?

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

John Youngquist

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

Reply by email

Michalis Kamburelis
to John Youngquist

2016-06-28 15:05 GMT+02:00 John Youngquist :

Show quoted text 6 lines
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

Reply by email

Tomas Hajny
to Michalis Kamburelis
Michalis Kamburelis wrote
2016-06-28 15:05 GMT+02:00 John Youngquist :

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

Show quoted text 33 lines
> 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

Reply by email