dvorak@ast.dsd.northrop.com (dvorak joseph l.) (06/18/91)
I need to provide a text field for user input into my Smalltalk/V program. I do _NOT_ want the user to have to select the the text like you must in the Transcript window. A specific key (a control-D perhaps) would terminate text entry. This would allow multi-line input. The text would be returned to my program as the result of the message sent to this text entry object. Can anyone tell me how to do this or point me to code that already does this? Thanks. Joe
tpermutt@eng.umd.edu (Thomas Permutt) (06/18/91)
In article <692@ast.dsd.northrop.com> dvorak@ast.dsd.northrop.com (dvorak joseph l.) writes: >I need to provide a text field for user input into my >Smalltalk/V program. I do _NOT_ want the user to have to >select the the text like you must in the Transcript window. A >specific key (a control-D perhaps) would terminate text >entry. This would allow multi-line input. The text would be >returned to my program as the result of the message sent to >this text entry object. > >Can anyone tell me how to do this or point me to code that >already does this? Thanks. > >Joe It seems to me you can use the methods of class TerminalStream, for example [Terminal read = CtrlD] whileFalse: [] . Ignore the obscure documentation about "finite-state machine"; what this does in the simplest case is character-by-character input from the keyboard. If you actually want the facilities of a TextEditor window, but simply don't want the user to have to select the text, you can surely figure out what he typed: for example, start with a blank window and treat all text as the input. You will need to modify the dispatcher to notice your control/d, though. What you probably really want is a Prompter, though, modified to quit on control/d instead of cr. This should be easy.