On Sat, 13 Jun 2009 00:01:21 Hugh Sasse wrote:
> On Fri, 12 Jun 2009, dave wrote:
> > After all the discussion on this matter I see that i have a problem.
> > being how to capture user interaction via the keyboard and allowing the
> > user to not be forced to use the mouse.
>
> At the moment, the only thing I can think of is that edit_lines take a
> block which is triggered when text is added to the contents.  I've not
> tried this, but I suppose if a tab character is inserted, the block could
> remove it and shift focus to the next edit_line.  Then that could shift
> focus on a tab to a submit button, and a keypress block might be able to
> pick up a return there, subject to the interaction of these keypress and
> edit_line facilities operating together nicely.
>
> I think one could then type
> 32946<tab>Fred Bloggs<tab><enter>
> to fill in both fields and submit.  But this is only running correctly
> in my head, which even I wouldn't recommend as a platform for serious
> computation!
>
> What do you think?
>

I did think of it too but to me it's a poor work around to this problem.
that's why i was thinking of using url block of some sort as a better fix.

I mean when you have a form on a web page (when you press enter in google as 
an example it activates the click event).

So here is th question if you have a button and when you press enter you 
direct the event to the button and let it do the rest then it'll be a click 
event handling the rest of the code.

so to me it'd be some like....

keyrpess do |key|

  when :enter
    buttonfind.click <- this being a button on screen called find.

  when "\n"
     buttonfind.click
  end
end

 _OR_ would this still be a problem?

Changed the keypress to be outside the stack block (it still works on my OS).

could I please get feed back on those using Mac's and Windows please?
on my OS tab moves to the next edit line and shift+tab move back could this 
action be confirmed too?

cheers,

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

      end
      
      keypress do |key|
        case key 
        when :enter
          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

Reply via email to