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
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
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
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
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
© 2022 - 2024 — McMap. All rights reserved.