Home » U++ Library support » U++ Widgets - General questions or Mixed problems » *Hold() mouse events only work for widgets at top-left corner
*Hold() mouse events only work for widgets at top-left corner [message #56735] |
Thu, 08 April 2021 10:53  |
Tom1
Messages: 1303 Registered: March 2007
|
Ultimate Contributor |
|
|
Hi,
E.g. LeftHold() mouse event only works for widgets at top-left corner of the window. (The same issue can be seen in both Windows and GTK/Linux.) I tracked down the code and found that sDistMax() comparison of leftmousepos and mousepos are incompatible in a way that leftmousepos is window client area related and mousepos is widget related. Therefore, comparison fails and not LeftHold() is never called:
void Ctrl::LHold() {
GuiLock __;
if(sDistMax(leftmousepos, mousepos) < GUI_DragDistance() && repeatTopCtrl && GetMouseLeft())
repeatTopCtrl->DispatchMouseEvent(LEFTHOLD, repeatMousePos, 0);
}
EDIT: Would this be a correct fix?
void Ctrl::LHold() {
GuiLock __;
if(sDistMax(leftmousepos, mousepos + mouseCtrl->GetRect().TopLeft()) < GUI_DragDistance() && repeatTopCtrl && GetMouseLeft())
repeatTopCtrl->DispatchMouseEvent(LEFTHOLD, repeatMousePos, 0);
}
The same issue applies to RightHold() and MiddleHold().
Best regards,
Tom
[Updated on: Thu, 08 April 2021 11:42] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Wed May 14 22:51:47 CEST 2025
Total time taken to generate the page: 0.01784 seconds
|