Typing 'Input' on Displayed Text

W

woodyee

Hi! While shopping this weekend, I noticed lots of department stores
using an older 'template' on the checkout registers which had info
displaying and they simply typed in the info and entered or tabbed to
the next field, sorta like this:

First Name: Last Name:
Street: Town:
City: State:

How can I do this in Ruby? I can do simple "Your name? (user writes
name), then another question/user replies, another question/user
replies" but how can I display text and have the user go through to the
end? Hope this makes sense. Thanks!
 
B

Bira

How can I do this in Ruby? I can do simple "Your name? (user writes
name), then another question/user replies, another question/user
replies" but how can I display text and have the user go through to the
end? Hope this makes sense. Thanks!

You can do this sort of "fancy text terminal" in Ruby using libraries
such as "curses" or "ncurses", which are written in C and possess Ruby
bindings. There's a more elaborate library written in Ruby called
Highline, IIRC, which seems to handle most of the fiddly detail for
you. I also want to try this out some day, but I haven't got around to
it yet :).
 
W

woodyee

Hi! This example was what I've been getting myself. What I want is when
you run the program, you have the 'questions' already displayed on the
screen.

Ex:
c:\ ruby test.rb
First Name: Last Name:
Town: City:

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top