Improve Handling of BOLD for Treeview control

Propose new features and changes
toralf
Posts: 868
Joined: 27 Apr 2014, 21:08
Location: Germany

Improve Handling of BOLD for Treeview control

06 Sep 2018, 09:08

While working with a treeview control, I realized, that handling BOLD is not as efficient as CHECKED or SELECTED or Expanded.
a) For CHECKED and SELECTED two functions exist, to find the checked or the selected item:

Code: Select all

TV_GetNext([ItemID, "Checked | Full"])
and
TV_GetSelection()
No function exists that finds the next bold item. I currently have to loop through all items of the treeview to find it/them.

b) To modify "Check" and "Expand" I can add a VarContainingOne (or Zero) to change the state or have a "+/-" infront of them. For Bold i have to use "+Bold" or "-Bold"

Thus, my wish is:
1) Extend: TV_GetNext([ItemID, "Checked | Full | Bold"])
2) Extend "Bold" to allow appending a VarContainingOne (or Zero) to change the state

Wish 2) might also be valid for "Select|Vis|VisFirst" due to consistency.
ciao
toralf
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Improve Handling of BOLD for Treeview control

07 Sep 2018, 19:06

a) TV_GetNext(ID, "Checked") and TV_GetSelection() retrieve user input. Bold, on the other hand, is always a direct result of the script, not the user, having set that state. It does not change after the item is added, unless the script changes it.

Perhaps Bold indicates an item has some property that other items do not have, and you may want to later retrieve all such items. However, this only allows for a single binary property (absent or present, true or false), so I think it has very limited use. And because you know the item has the property when you add it, you can record that. For instance, if you assign bold_items[n] := true or bold_items.push(n) where n is the node's ID, a simple for-loop will give you the bold items back. The same principle can apply to properties that can't be represented as TreeView item states.

b) I agree that "Bold0" should be supported, since "Check0" and "Expand0" are. Commit ab077b61 fixes it.

Related comments from the source code:
//else since "de-select" is not a supported action, no need to support "-Select".
// Furthermore, since a TreeView is by its nature has only one item selected at a time, it seems
// unnecessary to support Select%VarContainingOneOrZero%. This is because it seems easier for a
// script to simply load the Tree then select the desired item afterward.
...
// Since this option much more typically used with TV_Modify than TV_Add, the technique of
// Vis%VarContainingOneOrZero% isn't supported, to reduce code size.
...
// Bold%VarContainingOneOrZero isn't supported because due to rarity. There might someday
// be a ternary operator to make such things easier anyway.
Wish 2) might also be valid for "Select|Vis|VisFirst" due to consistency.
To either perform the action or do nothing? It doesn't seem worthwhile to me.
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Improve Handling of BOLD for Treeview control

10 Nov 2018, 20:15

Bold0 and Bold1 are supported in v1.1.30.01.
toralf
Posts: 868
Joined: 27 Apr 2014, 21:08
Location: Germany

Re: Improve Handling of BOLD for Treeview control

11 Nov 2018, 01:34

That’s great. Thanks a lot
ciao
toralf

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 22 guests