Code below should fix it.
keypress do |key|
if key == "\n"
debug 'pressed enter !'
if @custno != nil
alert 'cust number has a value !'
elsif @custname != nil
para 'cust name has a value !'
end
end
end
keypress is a method which takes a block. I suggest you read the
documentation carefully.
--
Regards
Abhijith
On Wed, Jun 10, 2009 at 2:41 PM, dave<[email protected]> wrote:
> I have a shoes program (below this message) where what i want to do is to
> allow the user to enter data into 1 of 2 edit_lines.
>
> From the user pressing enter i then check which edit_line has something in
> it
> and setup parameters for a SQL statement that 's in a class called dbase
> that's inside a module called sqlite3_calls.
>
> this tho is of no importance yet as i cannot capture the enter key!
>
> Note I'm only wanting to get 1 of the two edit_lines working then get the
> other done once i working based on the solution for the 1st one.
>
> Currently what happens is that the program runs but when I alt+/ to see the
> debug window after my shoes screen appears i see a comment saying pressed
> enter! when in fact i haven't press a dam thing except .
>
> did a search on keypress and edit_line and keypress but nothing i saw really
> gave me any hints.
>
> Dave.
>
> code as it stands is below.....
>
> require "sqlite3_calls.rb"
>
> Shoes.app do
> # extend Dbase #for the purposes isolation I've commented out this line
>
> stack :top =>5, :height => 90 do
> title "Find Customer Info", :align => 'center'
> end
>
> flow :top => 100, height => 70 do
> para strong "Customer nos"
> @custno = edit_line :width => 50 :focus
>
> para strong 'customer name'
> @custname = edit_line :width => 270
> end
> if keypress = :enter or keypress = "\n"
> debug 'pressed enter !'
> if @custno != nil
> para 'cust number has a value !'
> # rows = rec_to_find('customers', 'cust_nos', @custno) # please ignore
> else
> if @custname != nil
> para 'cust name has a value !'
>
> end
>
> end
> end
>
>
> flow :top => 550 do
> para strong 'data return shown here!'
> end
>
> end
--
Queer little twists and quirks go into the making of an individual.
To suppress them all and follow clock and calendar and creed until the
individual is lost in the neutral gray of the host is to be less than
true to our inheritance.
Life, that gorgeous quality of life, is not accomplished by following
another man's rules.
It is true we have the same hungers and same thirsts, but they are for
different things and in different ways and in different seasons.
Lay down your own day, follow it to its noon, or you will sit in an
outer hall listening to the chimes but never reaching high enough to
strike your own.