Recent

Author Topic: How to block mouse without blocking keyboard?  (Read 314 times)

Yurgenz

  • New Member
  • *
  • Posts: 23
How to block mouse without blocking keyboard?
« on: March 19, 2025, 06:19:30 pm »
Hi all.
I need to block the mouse without blocking the keyboard in a cross-platform GUI application (Windows, Linux/Debian). The program has many forms and buttons, and creating a handler for each one is too labor-intensive. Is there a way to block the mouse using Lazarus' built-in tools, rather than through the operating system?

jamie

  • Hero Member
  • *****
  • Posts: 6874
Re: How to block mouse without blocking keyboard?
« Reply #1 on: March 19, 2025, 06:25:49 pm »
 U can capture and by pass the mouse messages but u will still see the pointer
The only true wisdom is knowing you know nothing

Yurgenz

  • New Member
  • *
  • Posts: 23
Re: How to block mouse without blocking keyboard?
« Reply #2 on: March 19, 2025, 06:31:11 pm »
U can capture and by pass the mouse messages but u will still see the pointer
Pointer is no problem - Screen.Cursor := crNone;
How can I capture mouse messages for all application?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11030
  • Debugger - SynEdit - and more
    • wiki
Re: How to block mouse without blocking keyboard?
« Reply #3 on: March 19, 2025, 06:39:57 pm »
Capture does only work if the button is down (at least on Windows / as documented on msdn).

Maybe, if you put a transparent form on top of everything? Never tried, don't know.

Yurgenz

  • New Member
  • *
  • Posts: 23
Re: How to block mouse without blocking keyboard?
« Reply #4 on: March 19, 2025, 06:45:54 pm »
Capture does only work if the button is down (at least on Windows / as documented on msdn).

Maybe, if you put a transparent form on top of everything? Never tried, don't know.
Alas! I thought about using a transparent form, but it would interfere with the Z-Order of the forms, which is important to me. I also considered using a transparent panel on the form, but I couldn't manage to make the panel transparent.

 

TinyPortal © 2005-2018