Below is the code that will NOT allow a enter key press to be caught by my 
keyboard (at present).

If you uncomment the two lines and remove the ,'\n' from teh first when clause 
i can get the numeric enter key to be caught when pressed.

both key return the value 13 from a test page i got directed to (I think at 
shoes home page (else I've forgot where - know _why was the author anyway).

Shoes.app do

  def what_has_data
    if @custno.text.length > 0                 
      alert 'You entered a value into the Customer Number edit line'
    else
      if @custname.text.length > 0        
        alert 'You entered a value into the Customer Name edit line'
      end 
    end             
  end
      
  stack :top =>5, :height => 90 do
    title "Find Customer Info", :align => 'center'
  end
  
  
    flow :top => 100, :height => 80 do 
        para strong "Customer nos"
        @custno = edit_line :width => 50

        para strong 'customer name'
        @custname = edit_line :width => 270
    
      keypress do |key|
        case key 
        when :enter, '\n'
          what_has_data
        

#uncomment the 2 lines below & delete this and the begin - end pairs
#to get it to work as per my PC
#        when "\n"
#         what_has_data
          
        end  
      end
    end
end

Reply via email to