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 #6196 is a reply to message #6193] Thu, 02 November 2006 14:39 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
unodgs wrote on Thu, 02 November 2006 03:36

Ok, it's not so perfect... Wink



Smile

Quote:


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?



Have you tested? This does not seemt to be correct to me; if I remember well, parent is always NULL here.... (DispatchMouseEvent is called by host platform for TopWindow).

Anyway, I think the requirement itself is sound.

Mirek
 
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:33 CEST 2025

Total time taken to generate the page: 0.05538 seconds