Pressing the Enter key instead of the Click button with shoes (Ruby)

As the name implies, I'm just looking for a way to press a button in a shoe without a click.

I was looking for a forum, but unfortunately I can’t find anything.

thanks

+6
source share
2 answers

which will not work in red shoes under the windows, as Windows controllers will steal all events. I managed to get it at work in green shoes under the windows.

Here is 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

+1
source

I don’t have shoes at the moment, but I believe that you can capture a keystroke and execute its action like this:

 button('Click me') { do_something } keypress { |k| do_something if k == '\n' } 

From the manual:

Beware of all these rules: usually the Return key gives you the string "\n" . However, when pressed using modifier keys, you find yourself with :control_enter :control_alt_enter :shift_alt_enter

+1
source

Source: https://habr.com/ru/post/895418/


All Articles