Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
Tom1
Messages: 1253
Registered: March 2007
Senior 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

Re: *Hold() mouse events only work for widgets at top-left corner [message #56740 is a reply to message #56735] Fri, 09 April 2021 09:52 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14112
Registered: November 2005
Ultimate Member
Thanks, fixed.
Re: *Hold() mouse events only work for widgets at top-left corner [message #56748 is a reply to message #56740] Fri, 09 April 2021 16:16 Go to previous message
Tom1
Messages: 1253
Registered: March 2007
Senior Contributor
Thanks, it works now.

BR,

Tom
Previous Topic: Ctrl Transparency, backpaint, ...
Next Topic: *Triple() mouse event issue
Goto Forum:
  


Current Time: Sun Nov 10 20:20:32 CET 2024

Total time taken to generate the page: 0.01162 seconds