Juge <
jyrki.m...@gmail.com> wrote:
> Also a good idea, however I do not have an idea how to bind right
> click to a menuobject? What to use for widget or a bodytag?
This is Tcl/Tk, read the man pages and start experimenting:
#!/usr/bin/wish
menubutton .mb -text "Push Me"
pack .mb
menu .mb.menu
.mb.menu add command -label A -command [list puts menu-item-a]
.mb.menu add command -label B -command [list puts menu-item-b]
.mb configure -menu .mb.menu
bind .mb.menu <Button-3> {RC %W %y}
proc RC {w y} {
set idx [$w index @$y]
# if the menu has a tearoff entry, do nothing with it here
if {[$w cget -tearoff] && ($idx == 0)} {return}
puts "Menu entry with -label [$w entrycget $idx -label] right-clicked"
return -code break
}
What I've not bothered to dig out yet is how to turn off the menu
entry's -command option firing as well after the right-click binding.