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 » FIX - Single Click does not open/close items
FIX - Single Click does not open/close items [message #13464] Wed, 09 January 2008 23:33 Go to previous message
loki is currently offline  loki
Messages: 36
Registered: October 2007
Member
Hello,

if the TreeCtrl is scrolled to the left, the calculation for the one-click open/close goes wrong.

I think this fix it.
void TreeCtrl::DoClick(Point p, dword flags, bool down)
{
	Point org = sb;
	if(p.y + org.y > sb.GetTotal().cy)
		return;
	int i = FindLine(p.y + org.y);
	const Line& l = line[i];
	int x = levelcx + l.level * levelcx - org.x - (levelcx >> 1) /*- org.x*/;
	if(p.x > x - 6 && p.x < x + 6) {
		if(down)
			Open(l.itemi, !IsOpen(l.itemi));
	}
	else {
		if(down && IsSel(l.itemi)) {
			selclick = true;
			return;
		}
		SetFocus();
		int q = cursor;
		SetCursorLine(i, true, false, true);
		if(multiselect) {
			int id = GetCursor();
			if(flags & K_CTRL) {
				SelectOne(id, !IsSelected(id));
				anchor = cursor;
			}
			else
				if(flags & K_SHIFT)
					ShiftSelect(anchor < 0 ? cursor : anchor, cursor);
				else {
					if(selectcount) SelClear(0);
					SelectOne(id);
					anchor = cursor;
				}
		}
		if(cursor != q)
			WhenAction();
	}
}



Could it be, that withopen has no effect? In the testcase it does not work.
tree.Add(int parentid¸ const Image& img¸ Value v¸ bool withopen)


greetings
loki
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to turn of tool-tips please?
Next Topic: A [TreeCtrl] bug
Goto Forum:
  


Current Time: Sun Apr 28 00:46:55 CEST 2024

Total time taken to generate the page: 0.02923 seconds