Home » U++ Library support » TreeCtrl » Two problems (1 serious) with TreeCtrl
Re: Two problems (1 serious) with TreeCtrl [message #9592 is a reply to message #9576] |
Fri, 18 May 2007 14:58   |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
Thanks, the fix above works perfectly. Unfortunately the more I've tested this ctrl the more issues I have found, including a bug (in the latest dev) where the Ctrl destructor triggers a callback (~Ctrl->Close...->TreeCtrl::ChildRemoved->Dirty->ClearSelection), causing a crash.
Quote: | I think that selected and cursor are two distinct things..
|
True, but that doesn't mean I have to like it
The separation works well if you are using the ctrl (or ColumnList ctrl) with multiselect = true, but causes problems when in single selection mode.
For instance, if multiselect=false and an item is clicked no items are actually selected but the cursor is set (this is why WhenSel is triggered in SetCursor). This is good because unless you are using multi-selection you shouldn't have to scan the whole tree to get the selected node. On the other hand, SetCursorLine must check that the node can be selected and to be consistent SetCursor should NOT trigger WhenSel().
I think I've finally fixed all of the bugs/problems mentioned above, plus quite a few others (including the crash). I've left the WhenSel callback in SetCursor[Line], but prevented triggering when in multisel mode as this is both incorrect and produces multiple callbacks on click events. I've also modified Key handling.
I won't bother listing changes here as they are fairly extensive. I've attached the files and my test package.
James
-
Attachment: TreeTest.zip
(Size: 1.53KB, Downloaded 565 times)
-
Attachment: TreeCtrl.h
(Size: 10.34KB, Downloaded 660 times)
-
Attachment: TreeCtrl.cpp
(Size: 29.65KB, Downloaded 626 times)
[Updated on: Fri, 18 May 2007 15:02] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sun Sep 07 19:29:28 CEST 2025
Total time taken to generate the page: 0.07709 seconds
|