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 » Bug changing text after node insertion
Re: Bug changing text after node insertion [message #16947 is a reply to message #16942] Tue, 22 July 2008 15:56 Go to previous messageGo to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
cbpporter wrote on Tue, 22 July 2008 11:10

Now all works pretty much as expected. All I need to do is make the control select the item that is clicked upon. Any suggestions how to do this with OptionTree?

I must admit to not being able to follow this thread or work out exactly what it is you are trying to do Smile

However, I believe you can achieve the above like this (as long as you are using "" labels for the Options and setting the text with node values):
// Add a callback to the Option (must be added not to break SetOption)
tree.GetNode(nodeid).ctrl->WhenAction << THISBACK(OptionClick);

// Callback function
// Fake left click as if the option wasn't there
void OptionClick()
{
	dword flags = GetMouseFlags();
	Point p = tree.GetMouseViewPos();
	tree.LeftDown(p, flags);
	tree.LeftUp(p, flags);
}

The only other thing is that there seems to be a bug with MultSelect + Ctrls. To get selection working correctly with the Ctrl key I had to modify ChildGotFocus to stop it clearing the selection constantly.
void TreeCtrl::ChildGotFocus()
{
	if (multiselect) return; // Don't clear multi-selection!
	for(int i = 0; i < line.GetCount(); i++) {
		Item& m = item[line[i].itemi];
		if(m.ctrl && m.ctrl->HasFocusDeep()) {
			SetCursorLine(i);
			return;
		}
	}
}
but you could equally do this by using a sub-class of OptionTree with an empty ChildGotFocus function.
 
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
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: IsSelected(id)
Next Topic: Clear() and external controls as nodes
Goto Forum:
  


Current Time: Wed Aug 27 13:22:48 CEST 2025

Total time taken to generate the page: 0.06577 seconds