You need to use double quotes to escape \n. Currently, you have single
quotes.

I hate it when this happens to me.

:brad

On Thu, Jun 11, 2009 at 8:01 AM, dave <[email protected]> wrote:

> 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
>
>
>


-- 
Bradley Grzesiak
[email protected]
http://toleoandbeyond.blogspot.com

* You have received an email from my personal account. Please do not divulge
this address to any website (eg: evite, shutterfly, etc). I have another
address for such uses; please ask me for it.

Reply via email to