TreeView : parent of parent of parent of ... of item
2 posts
• Page 1 of 1
TreeView : parent of parent of parent of ... of item
Dear All,
with
by mouse, i select an item.
i search vector of all parents from root to selected item.
by hands, i do
but, in case of all unselect
i feel a dfns is a better solution, but i don't see how to write in dfns.
can you explain to me how to write it ?
Best Regards,
Yves
with
'bn'⎕WC'form'('coord' 'pixel')
'bn.tv'⎕WC'treeview'
depth←0 1 2 3 3 2 2 3 3 1 2 3 3 2 3 3
itm←1⊂[1]'abcdefghijklmnopqrstuvwxyz'[?((⍴depth),3)⍴26]
bn.tv.(Items Depth)←itm depth
by mouse, i select an item.
⍸ bn.tv.SelItems
12
i search vector of all parents from root to selected item.
by hands, i do
bn.tv.GetParentItem 12
11
bn.tv.GetParentItem 11
10
bn.tv.GetParentItem 10
1
but, in case of all unselect
bn.tv.SelItems
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
bn.tv.GetParentItem 0
¯1
i feel a dfns is a better solution, but i don't see how to write in dfns.
can you explain to me how to write it ?
Best Regards,
Yves
- Yves
- Posts: 39
- Joined: Mon Nov 30, 2015 11:33 am
Re: TreeView : parent of parent of parent of ... of item
with
my actual function is
and result are
weakness, not very elegant...
]box on
]row on
my actual function is
result←parentOfItem no
result←no
:Repeat
no←bn.tv.GetParentItem no
result←no,result
:Until 0=no
result←sort{(0≠⍵)/⍵}result
and result are
parentOfItem ¨ ⍳ (⍴ bn.tv.Items)
┌─┬───┬─────┬───────┬───────┬─────┬─────┬───────┬───────┬────┬───────┬──────────┬──────────┬───────┬──────────┬──────────┐
│1│1 2│1 2 3│1 2 3 4│1 2 3 5│1 2 6│1 2 7│1 2 7 8│1 2 7 9│1 10│1 10 11│1 10 11 12│1 10 11 13│1 10 14│1 10 14 15│1 10 14 16│
└─┴───┴─────┴───────┴───────┴─────┴─────┴───────┴───────┴────┴───────┴──────────┴──────────┴───────┴──────────┴──────────┘
weakness, not very elegant...
- Yves
- Posts: 39
- Joined: Mon Nov 30, 2015 11:33 am
2 posts
• Page 1 of 1
Return to Functional Programming
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group