FireMonkey - how to capture TScrollBar mouse events? - firemonkey

I'm trying to capture mouse events on a TScrollBar. In design time, I created a handler for each mouse event, on the Events tab of the Object Inspector. At runtime, the TScrollBar does not fire the mouse events, therefore the handlers are not executed. For instance, when the mouse pointer enters the TScrollBar, the OnMouseEvent never triggers the associated ScrollBarMouseEnter. I'm working with FireMonkey, Berlin 10.1 Update 2, Win32 platform. Any help would be appreciated.

Related

How to properly override mouse events in other apps (Windows)?

I'm trying to implement system-wide drag operation with middle mouse button. It should override middle mouse drag behavior in other programs. Currently, I am handling global mouse events with system-wide hooks.
Problem is - many programs still receive and handle same events like I did not intercept them.
Here's what I tried:
not call the next hook for mouse down event: I never receive mouse up, so I don't know where and when to stop dragging
not call the next hook for mouse move: cursor slows down tremendously
not call the next hook for mouse up: most windows in the system stop reacting to mouse events completely after my drag is finished
always call the next hook in the chain: if the control under mouse has scroll in it, most of the time it will be scrolling while my drag is in progress. Also UWP apps continue receiving mouse events during my drag, so if a link in MS Edge happens to be under cursor when it started, and mouse does not leave Edge boundary, Edge receives click event, and new tab is opened
What I need is: when user holds middle mouse and starts dragging, my drag handler should be called, and no other handlers, like file drag, scroll, etc should happen.
I ended up with somewhat hacky solution:
do not call the next hook for mouse down for middle button
record where it was pressed
when handling mouse up, if user did not drag - replay the whole mouse up + mouse down using SendInput from a separate thread (to avoid deadlock due to reentrancy)

Mouse hover when mouse is idle

My apps need to detect that mouse is not having any action or idle for some time to hide a view. I am working on Mac OS X application. Please help
Create a NSTimer that hides the view after x seconds.
Track the mouse by adding a NSTrackingArea on top of your window. Or if you want all events subclass NSApplication and overwrite sendEvent. Reset the timer when you receive an event.

What is the low-level trigger for Windows Click events

The standard sequence of events to trigger a mouse click in Windows is documented here:
MSDN
Essentially it is:
MouseDown event.
Click event.
MouseClick event.
MouseUp event.
However, I have a control which is altering the sequence of events by capturing events on its children (to implement dragging). That means that the full sequence might not execute, e.g. currently I have a button which sees a MouseDown event, but no MouseUp event when the mouse is clicked.
Therefore the question is, what actually triggers the click at a low-level? Does it need a MouseDown followed by a MouseUp. Will a MouseUp on its own be sufficient? Are there any other considerations?

How to capture WM_NCLBUTTONDBLCLK event with wxPython?

I'm using wxPython. I want to detect mouse events on the caption bar. I noticed that there is a event called WM_NCMOUSEHOVER under windows. But I cannot find corresponding event in wxPython. Here is the question, how can I capture those non-client events with wxPython?
I can't find a way to get mouse events from the frame title bar. The closest I got was EVT_MOTION. However, you might be able to use a wx.Timer in combination with wx.GetMousePosition(). See Capturing mouse events outside wx.Frame in Python for more info.

gwt mouse over events not fired when mouse button is down

When you push down the left mouse button mouse down event fires. If you then move the mouse over a label (while holding the mouse button down) mouse over event does not fire.
Is there any way to enable this events or fire them manualy or simulate them?
What you are actually doing is two separate events, one is a mouse down event as you have described and the other is a mouse drag.
If you want to simulate them, that you might have to consider using a mouse click to track the user's (x,y) location. Subsequently, if you want to "simulate" it you could do some computation and decide for yourself if it is indeed a mouse click or mouse drag event that has occurred.
Hope it helps :) Cheers!

Resources