Reputation: 175
As the title suggests, I'm just looking for a way of pressing a button in Shoes without clicking it.
I've searched the forum, but unfortunately can't find anything.
Thanks
Upvotes: 6
Views: 1209
Reputation: 42192
that won't work in red shoes under windows since the windows controlls steal all the events. I managed to get this at work in green shoes under windows though.
Here an example
['green_shoes'].each(&method(:require))
Shoes.app{
e = edit_line
button("Click me!"){alert("You clicked me.")}
keypress { |k| alert("You pressed Enter") if k == "\n"}
}
Grtz
Upvotes: 1
Reputation: 599
I do not have shoes at the moment, but I believe you could trap the keypress and execute its action like so:
button('Click me') { do_something }
keypress { |k| do_something if k == '\n' }
From the manual:
One caveat to all of those rules: normally the Return key gives you a string
"\n"
. When pressed with modifier keys, however, you end up with:control_enter
,:control_alt_enter
,:shift_alt_enter
Upvotes: 1