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 » TreeCtrl » Like the new Drag and Drop TreeCtrl but...
Re: Like the new Drag and Drop TreeCtrl but... [message #11219 is a reply to message #11150] Tue, 28 August 2007 00:40 Go to previous messageGo to previous message
nixnixnix is currently offline  nixnixnix
Messages: 415
Registered: February 2007
Location: Kelowna, British Columbia
Senior Member
If I replace the option in the modified reference example with the derived option control below


class LayerOption : public Option {
private:
	virtual void LeftDown(Point p, dword keyflags) 
	{
		if(p.x<this->GetSize().cy)
			Option::LeftDown(p, keyflags);
		if(this->GetData()==true)
		{
			SetFocus();			
		}
		// now send pass on this event to the parent for possible drag and drop 
		TreeCtrl* pCtrl = (TreeCtrl*)this->GetParent();
		Point pt = p + GetRect().TopLeft(); // transform event into parent coordinates
		if(p.x>this->GetSize().cy)
			pCtrl->LeftDown(pt,keyflags);

		Refresh();
	}

};


I can select as well as using the option. The code above appears to change the selection registered by the tree control (although it fails to generate the WhenSel or WhenCursor events). I say it appears to register the selection cos when I ask the tree for the cursor position it reports it as being the node whose option that I just clicked on.

An alternative to coding an option tree with drag and drop would be if the Option control could be "selected".

Another problem with my code above is that it does not kick off the WhenDrag event even though I pass the event to the parent.


Nick







 
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
Read Message
Read Message
Read Message
Read Message
Previous Topic: TreeCtrl Scroll triggers Parent Refresh
Next Topic: hierarchical tree data structure & binding to TreeCtrl
Goto Forum:
  


Current Time: Thu Aug 21 06:07:36 CEST 2025

Total time taken to generate the page: 0.04959 seconds