Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sample.eng.ohio-state.edu!purdue!haven.umd.edu!mimsy!mojo!tpermutt From: tpermutt@eng.umd.edu (Thomas Permutt) Newsgroups: comp.lang.smalltalk Subject: Re: Entering Text Message-ID: <1991Jun18.165900.26469@eng.umd.edu> Date: 18 Jun 91 16:59:00 GMT References: <692@ast.dsd.northrop.com> Sender: news@eng.umd.edu (C-News) Distribution: usa Organization: College of Engineering, Maryversity of Uniland, College Park Lines: 27 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.