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 » Two problems (1 serious) with TreeCtrl
Two problems (1 serious) with TreeCtrl [message #9574] Thu, 17 May 2007 19:07 Go to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
The first is just annoying, the second is more important:
1) Nodes can be selected (and still trigger WhenSel) when canselect is false. My suggested fix:
void TreeCtrl::SetCursorLine(int i, bool sc)
{
	if(nocursor)
		return;
	if(i != cursor) {
		i = minmax(i, 0, line.GetCount() - 1);
		if(i < 0) return;
		Item& m = item[line[i].itemi];
		if (!m.canselect) return; <<= This line added by me
		if(sc)
			sb.ScrollIntoY(line[i].y, m.GetSize().cy);
		RefreshLine(cursor);
		cursor = i;
		RefreshLine(cursor);
		if(m.ctrl && m.ctrl->SetWantFocus())
			return;
		WhenCursor();
		WhenSel();
	}
}

2) Opening/closing nodes causes WhenSel to be triggered, which is correct under some conditions but it will be triggered even when the selection doesn't actually change.

What makes this problem worse is that WhenSel is called from SyncTree, which is called by Paint. If you have code that causes a call to Ctrl::WindowProc (say PromptOK) int your WhenCursor or WhenSel callbacks this will trigger the
ASSERT(!sPainting);

macro and presumably crash a non-debug build.

Sorry, I don't have time to post a test case now, but I'll do one in the morning.
James
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Serialize
Next Topic: Tree Control - how to access properties of node.ctrl?
Goto Forum:
  


Current Time: Tue Apr 23 17:40:00 CEST 2024

Total time taken to generate the page: 0.03180 seconds