Search code examples
rubyshoes

Pressing the Enter key instead of Clicking button with Shoes (Ruby)


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


Solution

  • 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