View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0035270 | Lazarus | LCL | public | 2019-03-25 10:03 | 2019-04-24 22:19 |
Reporter | ptvs | Assigned To | Juha Manninen | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | Intel Core i3-7100 | OS | Microsoft Windows 7 SP1 x86 | ||
Product Version | 2.1 (SVN) | ||||
Summary | 0035270: Handling mouse events through shaped TWinControl | ||||
Description | If you position TGraphicControl decendant under TWinControl decendant, and then change TWinControl's shape with SetShape so that TGraphicControl become visible, all mouse events on the TGraphicControl would be handled by the form. This happens in TWinControl.IsControlMouseMsg(): [code] // do query wincontrol children, in case they overlap Control := ControlAtPos(SmallPointToPoint(MouseMessage.Pos), [capfAllowWinControls]); if Control is TWinControl then begin // there is a TWinControl child at this position // TWinControl children get their own messages // => ignore here Control := nil; end; [/code] ControlAtPos() searches for TWinControl first (capfAllowWinControls in Flags), finds one, does not check for children (no capfRecursive in Flags) and returns the control. And the control is set to nil. (This seems a bit senseless to me) So, as no control found at mouse position the event handling is given to the form. I deleted capfAllowWinControls flag from the call, and it worked as expected (tested on Windows 7). I attached example project and a patch, please test. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | r61053 | ||||
LazTarget | - | ||||
Widgetset | Win32/Win64 | ||||
Attached Files |
|
|
|
|
handle_mouse_events.patch (836 bytes)
Index: lcl/include/wincontrol.inc =================================================================== --- lcl/include/wincontrol.inc (revision 60767) +++ lcl/include/wincontrol.inc (working copy) @@ -4709,15 +4709,7 @@ else begin // do query wincontrol children, in case they overlap - Control := ControlAtPos(SmallPointToPoint(MouseMessage.Pos), - [capfAllowWinControls]); - if Control is TWinControl then - begin - // there is a TWinControl child at this position - // TWinControl children get their own messages - // => ignore here - Control := nil; - end; + Control := ControlAtPos(SmallPointToPoint(MouseMessage.Pos), []); end; //DebugLn(['TWinControl.IsControlMouseMsg B ',DbgSName(Self),' Control=',DbgSName(Control),' Msg=',TheMessage.Msg]); |
|
|
|
|
|
Added test project (handle_mouse_events_test_project.zip) that should work both on Windows and Linux (GTK2) |
|
Applied, thanks. |
Date Modified | Username | Field | Change |
---|---|---|---|
2019-03-25 10:03 | ptvs | New Issue | |
2019-03-25 10:03 | ptvs | File Added: project1.zip | |
2019-03-25 10:03 | ptvs | File Added: handle_mouse_events.patch | |
2019-03-25 10:03 | ptvs | File Added: 2019-03-25_135656.png | |
2019-04-16 11:52 | ptvs | File Added: handle_mouse_events_test_project.zip | |
2019-04-16 11:54 | ptvs | Note Added: 0115544 | |
2019-04-24 22:18 | Juha Manninen | Assigned To | => Juha Manninen |
2019-04-24 22:18 | Juha Manninen | Status | new => assigned |
2019-04-24 22:19 | Juha Manninen | Status | assigned => resolved |
2019-04-24 22:19 | Juha Manninen | Resolution | open => fixed |
2019-04-24 22:19 | Juha Manninen | Fixed in Revision | => r61053 |
2019-04-24 22:19 | Juha Manninen | LazTarget | => - |
2019-04-24 22:19 | Juha Manninen | Widgetset | Win32/Win64 => Win32/Win64 |
2019-04-24 22:19 | Juha Manninen | Note Added: 0115791 |