Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Binding or executing a command with a TkOptionMenubutton
Alex DeCaria
3/16/2007 1:13:00 PM
I want my program to execute a command whenever a new selection is made
from a TkOptionMenubutton. The -command option isn't allowed with
TkOptionMenubuttons, so I've been experimenting with various bindings,
but can't find an appropriate binding event.
I've tried the following simple example which should print the value of
the selection, but it only works if the mouse is directly over the
button itself, and not over the expanded options.
Any ideas how to do this?
#------------------------------------
require 'tk'
root = TkRoot.new.title("MenuOptionbutton")
list = ["1", "2", "3", "4", "5"]
var = TkVariable.new
button = TkOptionMenubutton.new(root,var,*list).pack
button.bind('ButtonRelease-1') do
print var, "\n"
end
Tk.mainloop
#--------------------------------------------
--
Posted via
http://www.ruby-...
.
1 Answer
Hidetoshi NAGAI
3/16/2007 2:10:00 PM
0
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Binding or executing a command with a TkOptionMenubutton
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password