PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > is possible to edit text field in console?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
is possible to edit text field in console?

Réponse
 
LinkBack Outils de la discussion
Vieux 17/09/2007, 06h18   #1
Tom Cloyd
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut is possible to edit text field in console?

A beginner question for sure, but one on which I'm stuck: I'm trying to
determine if it's possible, by any means whatsoever, to display a line
of text on the console and allow the user to edit it, before pressing
Enter to cause it to be read back in. As far as I can tell, this is only
possible in a GUI display object. Before I move in that direction I
thought I'd check to see if I've missed anything.

Thanks for any anyone has.

t.
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 17/09/2007, 07h52   #2
Michael Linfield
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: is possible to edit text field in console?

Tom Cloyd wrote:
> A beginner question for sure, but one on which I'm stuck: I'm trying to
> determine if it's possible, by any means whatsoever, to display a line
> of text on the console and allow the user to edit it, before pressing
> Enter to cause it to be read back in. As far as I can tell, this is only
> possible in a GUI display object. Before I move in that direction I
> thought I'd check to see if I've missed anything.
>
> Thanks for any anyone has.
>
> t.


I dont quite understand why you would in fact want to have a line of
text that can be edited in a console...They would have to backspace to
change anything which would defeat the purpose. A GUI would be the way
to go in this case, and if u need with that just say so.
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 17/09/2007, 08h19   #3
Tom Cloyd
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: is possible to edit text field in console?

Thanks. You are, of course, right. I'm a Windows refugee in the process
of moving to Kubuntu, and I have little experience with the console, so
I overlooked this obvious fact about having to backspace. Ooops. So, GUI
it is. Onward!

Michael Linfield wrote:
> Tom Cloyd wrote:
>> A beginner question for sure, but one on which I'm stuck: I'm trying to
>> determine if it's possible, by any means whatsoever, to display a line
>> of text on the console and allow the user to edit it, before pressing
>> Enter to cause it to be read back in. As far as I can tell, this is only
>> possible in a GUI display object. Before I move in that direction I
>> thought I'd check to see if I've missed anything.
>>
>> Thanks for any anyone has.
>>
>> t.

>
> I dont quite understand why you would in fact want to have a line of
> text that can be edited in a console...They would have to backspace to
> change anything which would defeat the purpose. A GUI would be the way
> to go in this case, and if u need with that just say so.


--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Vieux 17/09/2007, 08h45   #4
Michael W. Ryder
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: is possible to edit text field in console?

Michael Linfield wrote:
> Tom Cloyd wrote:
>> A beginner question for sure, but one on which I'm stuck: I'm trying to
>> determine if it's possible, by any means whatsoever, to display a line
>> of text on the console and allow the user to edit it, before pressing
>> Enter to cause it to be read back in. As far as I can tell, this is only
>> possible in a GUI display object. Before I move in that direction I
>> thought I'd check to see if I've missed anything.
>>
>> Thanks for any anyone has.
>>
>> t.

>
> I dont quite understand why you would in fact want to have a line of
> text that can be edited in a console...They would have to backspace to
> change anything which would defeat the purpose. A GUI would be the way
> to go in this case, and if u need with that just say so.


I have a C routine that does exactly this without using any GUI. It
recognizes the keys to move and edit. Since it does not display the
keys pressed I am not sure if this is possible in Ruby without using
something like Curses. The original version used the hardware directly
and will probably not work with most current Operating Systems but it
was an easy conversion to use Curses.
  Réponse avec citation
Vieux 17/09/2007, 10h14   #5
Sebastian Hungerecker
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: is possible to edit text field in console?

Michael Linfield wrote:
> I dont quite understand why you would in fact want to have a line of
> text that can be edited in a console... They would have to backspace to
> change anything which would defeat the purpose.


No, they wouldn't. Do you have to hit backspace if you want to edit a command
in irb? Do you have to hit backspace to edit text in any non-GUI texteditor?


> A GUI would be the way
> to go in this case, and if u need with that just say so.


A GUI or readline or curses.


--
Jabber: sepp2k@jabber.org
ICQ: 205544826

  Réponse avec citation
Vieux 17/09/2007, 16h26   #6
John Joyce
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: is possible to edit text field in console?

For console-based apps, you really would do well with the NCurses
library.

The best documentation of it is a book that just came out by Dan
Gookin. Good writer. His work kicked off the entire line of for
Dummies books (even though some books in that line are terrible, but
not his).
NCurses is a C library, but there are some Ruby bindings to it.


  Réponse avec citation
Vieux 17/09/2007, 17h13   #7
Todd Burch
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: is possible to edit text field in console?

John Joyce wrote:
> For console-based apps, you really would do well with the NCurses
> library.
>
> The best documentation of it is a book that just came out by Dan
> Gookin. Good writer. His work kicked off the entire line of for
> Dummies books (even though some books in that line are terrible, but
> not his).
> NCurses is a C library, but there are some Ruby bindings to it.


I just bought this book last week. Great book. First book I've even
bought where one of the appendices (Appendix A - NCurses library
reference) is the majority of the book.

Todd
--
Posted via http://www.ruby-forum.com/.

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 16h21.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,14217 seconds with 15 queries