Well think i have solved this problem somewhat.

can others try it out?
would like to have the line blink as it would in a edit line ...

I would just like to give the user the ability to press enter as an 
alternative to using the mouse to click on a button or the user having to TAB 
though the controls to get to the button.

Yes I know there is no button in this sample script but it can easily be 
placed and my aim is to get a enter keypress working rather than the button 
click.

would the change method be a better place for the edit line?
haven't seen many samples using the change method.

thanks,

Shoes.app do

  def what_has_data
    if @custno.length > 0                 
      alert 'You entered a value into the Customer Number edit line'
    else
      if @custname.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 
      flow do
        @mypara = "Customer nos "
        para strong @mypara

# my attempt at getting a blinking line for what it's worth
        animate(100) do |i| 
          rect 120, 103,1,20, :stroke => black 
          rect 120, 103,1,20, :stroke => silver if i/2 == 0
          #rect 120, 103,1,20, :stroke => silver
        end

        #para strong "Customer nos "
        #...@custno = edit_line :width => 30
        #rect 120, 103,1,20
        
        #rect 120, 3, 50,20, :stoke => white
      end
        
        #start {[email protected]}
         
        para strong 'customer name'
        @custname = edit_line :width => 270

      end
      
      keypress do |key|
        case key 
          when '0'...'9'
            alert 'a number was entered!!!'
            @mypara + " #{key}"  #to display the number just entered 
            @custno = key                   
              
          when :enter, '\n'
            what_has_data
            
          when "\n"
            what_has_data
          
        end  
    end
end

Reply via email to