On Sat, 13 Jun 2009, dave wrote:
> 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.
> >
[...]
> > tried this, but I suppose if a tab character is inserted, the block could
[...]
> > 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.
You still have to handle what happens when you press enter when focus is
in the edit_line. Handling tabs to move between fields is also pretty
standard for the web.
>
> 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?
I think so because the focus is not moved out of the edit_line. Having
the button would tend to make people avoid keyboard only access, unless
that is what they always do. As they didn't say in the Highlander films,
"You only need one..."
>
> 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?
The code below looks pretty much the same as yesterdays, only with the
separate :enter and "\n" sections, and it still crashes on XP, before
I get chance to type a second digit in the custno field.
>
> 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
>
__END__
Hugh