Feature request for the value from AddGadgetItem to return the item value from a tree.
value = AddGadgetItem(#myTree, -1, Text$, 0, CurrentSublevel)
It would be nice if the value returned was the item number of the item just created.
Alternatively some other way of fetching the value of the last item created would be really useful.
Also a command like item=ParentItem( item) would be nice.
This would allow us to work our way back up a tree without using API calls.
Feature TreeGadget items
Re: Feature TreeGadget items
If you pass -1 as position in the 2nd parameter, the new item will be at index CountGadgetItems(#myTree)-1,alban wrote:Feature request for the value from AddGadgetItem to return the item value from a tree.
value = AddGadgetItem(#myTree, -1, Text$, 0, CurrentSublevel)
It would be nice if the value returned was the item number of the item just created.
Alternatively some other way of fetching the value of the last item created would be really useful.
and if you pass another position, the new item will be at the passed index.
Just examine the items sublevel like this:alban wrote:Also a command like item=ParentItem( item) would be nice.
This would allow us to work our way back up a tree without using API calls.
Code: Select all
Procedure GetParent(tree, item)
level = GetGadgetItemAttribute(tree, item, #PB_Tree_Sublevel)
parent = item-1
While parent >= 0 And level <= GetGadgetItemAttribute(tree, parent, #PB_Tree_Sublevel)
parent - 1
Wend
ProcedureReturn parent
EndProcedure
quidquid Latine dictum sit altum videtur