Jump to content
vipin

Bind Mouse button on tree widget - hwtk::treectrl

Recommended Posts

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.

 

image.png.0792975ac3fda25b9b479f3f75be8a2b.png

 

Share this post


Link to post
Share on other sites

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?

 

 

Share this post


Link to post
Share on other sites

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 {

                       ... 

                   }

                   ... ...

             }

        }

}

llyle, Pandurang and vipin like this

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...