Bind Mouse button on tree widget - hwtk::treectrl
Hi all,
Is it possible to bind mouse button operations on hwtk treectrl widget?
For example I have created a tree like below, when i click on any item, it should act as a button and execute some command.
Answers
-
Hi Vipin
did you try setting a callback for option -selectcommand when creating the treectrl ?
when you select some thing it will invoke -selectcommand
0 -
Hi @tinh
I added -selectcommand as you said.
Anything I select in the tree it is running that command, but how do I assign different script/command for each of the buttons?
0 -
Hi Vipin
example
set t [hwtk::treectrl $treewnd -selectcommand 'p_AtSelected %W']
proc p_AtSelected t {
set items [$t select]
#you may select more than 1 item so pls handle it
foreach item $items {
set text [$t item text $item 0]
switch -- $text {
button1 {
...
}
button2 {
...
}
... ...
}
}
}
0 -
Hey tinh,
Thanks a lot for the help. It is working perfectly!!
I Added -selectmode single, so multiple selection solved /emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20' />
0 -
can u share me this macros
0