Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
tk question - how do i bind to multiple events?
Max Williams
10/18/2007 12:15:00 PM
I have a text field, and i want to get the value out of it when the user
presses Return or tabs to another field. Currently i'm doing it like
this:
name_field = TkEntry.new(root)
var = TkVariable.new("f")
name_field.textvariable(name_var)
name_field.pack()
name_field.bind("Key-Return") { name_field_value = name_var.value }
name_field.bind("FocusOut") { name_field_value = name_var.value }
It seems like there should be a way to combine these, like
name_field.bind("Key-Return" || "FocusOut") #doesn't work
name_field.bind("Key-Return", "FocusOut") #doesn't work either
But these doesn't work. Can anyone tell me how to do this please?
--
Posted via
http://www.ruby-...
.
2 Answers
Hidetoshi NAGAI
10/18/2007 2:59:00 PM
0
Max Williams
10/18/2007 3:03:00 PM
0
Hidetoshi NAGAI wrote:
> Please use TkVirtualEvent object.
> -------------------------------------------------------------------------
> virt_ev = TkVirtualEvent.new("Key-Return", "FocusOut")
> # or use TkVirtualEvent#add(seq, ...) / TkVirtualEvent#delete(seq, ...)
>
> name_field.bind(virt_ev) { name_field_value = name_var.value }
Great, thanks!
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
tk question - how do i bind to multiple events?
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