title: How can I bind function with object in Ruby Shoes GUI?
body: <p>How can I call addition only when I press enter <strong>and</strong> <code>@e_ln1</code> is in focus? If I click enter while <code>@e_ln2</code> is in focus, addition in <code>@e_ln1</code> is also performed but I don't want it.</p>
  
  <pre><code>Shoes.app do
  
      @e_ln1 = edit_line(width: 150, height: 20)
      @e_ln2 = edit_line(width: 150, height: 20, left: 0, top: 60)
  
     keypress do |k|
          if k == "\n" 
              @e_ln1.text = @e_ln1.text.to_i + 1
          end
      end
  
  end
  </code></pre>