Luc <
[email protected]d> wrote:
When I click a Tk button with the left mouse button, the Tk button
"sinks" briefly to indicate that is has been pressed.
I can bind different actions to left and right mouse button clicks,
but Tk buttons won't "sink" when I right-click them.
How can I add that effect to clicks with the right mouse button?
In addition to Robert's suggestion, which you should do, the default
bindings can be illuminating, you can introspect Tk to find out what a
specific binding does:
$ rlwrap wish
% button .b
.b
% winfo class .b
Button
% bind Button
<ButtonRelease-1> <Button-1> <Leave> <Enter> <<Invoke>> <Key-space>
% bind Button <Button-1>
tk::ButtonDown %W
% info args tk::ButtonDown
w
% info body tk::ButtonDown
variable ::tk::Priv
# Only save the button's relief if it does not yet exist. If there
# is an overrelief setting, Priv($w,relief) will already have been set,
# and the current value of the -relief option will be incorrect.
if {![info exists Priv($w,relief)]} {
set Priv($w,relief) [$w cget -relief]
}
if {[$w cget -state] ne "disabled"} {
set Priv(buttonWindow) $w
$w configure -relief sunken
set Priv($w,prelief) sunken
# If this button has a repeatdelay set up, get it going with an after
after cancel $Priv(afterId)
set delay [$w cget -repeatdelay]
set Priv(repeated) 0
if {$delay > 0} {
set Priv(afterId) [after $delay [list tk::ButtonAutoInvoke $w]]
}
}
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)