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++ TheIDE » U++ TheIDE: Other Features Wishlist and/or Bugs » Ctrl * GetCallbackCtrl()
Re: Ctrl * GetCallbackCtrl() [message #6193 is a reply to message #6121] Thu, 02 November 2006 09:36 Go to previous messageGo to previous message
unodgs is currently offline  unodgs
Messages: 1367
Registered: November 2005
Location: Poland
Ultimate Contributor

Ok, it's not so perfect... Wink Because if I change cursor in ChildGotFocus for edits the cursor change its place immediately on left click. For rest of controls cursor change place in WhenAction routine and it happens mostly on left mouse up.
Anyway I patched a little bit CtrlCore Wink and I hope you'll accept this. What I've done is:

CtrlCore.h : Ctrl class

virtual void ChildMouseAction(Ctrl * ctrl, int event, Point p) {}


CtrlMouse.cpp

Image Ctrl::DispatchMouseEvent(int e, Point p, int zd) {
	if(!IsEnabled())
		return Image::Arrow();
	if(captureCtrl && captureCtrl != this && captureCtrl->IsMouseActive())
		return captureCtrl->MEvent0(e, p + GetScreenRect().TopLeft() -
		                            captureCtrl->GetScreenRect().TopLeft(), zd);
	Ctrl *top = this;
	if(e == MOUSEWHEEL && !GetParent()) {
		Ctrl *w = GetFocusCtrl();
		if(w) {
			top = w->GetTopCtrl();
			p = GetMousePos() - top->GetScreenRect().TopLeft();
		}
	}
	Ctrl *q = top->ChildFromPoint(p);
	if(parent)
		parent->ChildMouseAction(q, e, p);
	return q ? q->DispatchMouseEvent(e, p, zd) : top->MEvent0(e, p, zd);
}

This line was added:
if(parent) parent->ChildMouseAction(q, e, p);


With such a simple modification I can override ChildMouseActtion in my grid ctrl and has control over mouse events before they go to any child contol.

What do you think about it?
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Debugger error
Next Topic: Copy and Paste changes colors in Icon Edit [BUG]
Goto Forum:
  


Current Time: Sat Aug 16 22:43:27 CEST 2025

Total time taken to generate the page: 0.04883 seconds