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 |
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
|
|
|
|
|
FIX - Single Click does not open/close items
By: loki on Wed, 09 January 2008 23:33
|
|
|
Re: FIX - Single Click does not open/close items
By: mrjt on Fri, 11 January 2008 10:54
|
|
|
Re: FIX - Single Click does not open/close items
By: mirek on Sat, 12 January 2008 19:50
|
|
|
Re: FIX - Single Click does not open/close items
By: loki on Mon, 14 January 2008 22:51
|
|
|
Re: FIX - Single Click does not open/close items
By: mirek on Tue, 15 January 2008 00:01
|
|
|
Re: FIX - Single Click does not open/close items
By: mrjt on Tue, 15 January 2008 15:48
|
|
|
Re: FIX - Single Click does not open/close items
By: loki on Tue, 15 January 2008 20:54
|
|
|
Re: FIX - Single Click does not open/close items
By: mirek on Wed, 16 January 2008 08:32
|
|
|
Re: FIX - Single Click does not open/close items
By: loki on Wed, 16 January 2008 16:27
|
|
|
Re: FIX - Single Click does not open/close items
By: mirek on Thu, 17 January 2008 16:23
|
|
|
Re: FIX - Single Click does not open/close items
By: loki on Thu, 17 January 2008 21:48
|
Goto Forum:
Current Time: Sun Apr 28 08:41:22 CEST 2024
Total time taken to generate the page: 0.04121 seconds
|