Newbie Question on Text Input
Roger McDermott
rm at comp.rgu.ac.uk
Tue Nov 29 12:42:57 UTC 2005
Hi
I've just joined this list and I have a question regarding getting input
into Squeak. I would say at the outset that I am a novice programmer
(although I have used some Smalltalk before and know a little Java) so I
apologise if this is a bit basic.
I appreciate that one can use the Transcript window to give simple screen
output from code run in the Workspace but is there a similar (ready-made)
window that can be used to get input?
In one of the Java packages that I use there is a class called a
ConsoleWindow which allows input and output in the same window, e.g.
ConsoleWindow c = new ConsoleWindow();
c.out.println("Please input an integer");
myInteger = c.input.readInt();
c.out.println("Your integer times two is" + 2 * myInteger);
In private emails, Ken Rose pointed towards the Workspace window (but
unfortunately I am not adept enough to get that to work in the way I want)
and Stephane Ducasse gave me the following code snippet
| res |
res := FillInTheBlank request: 'please enter a number'.
res asNumber.
which does allow things to be input but the FillInTheBlank object disappears
as soon as you enter a number. I'm sure that there is a very simple way of
doing this but, at present, it is still unclear to me.
Any help would be much appreciated.
Roger McDermott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20051129/bedc1965/attachment.htm
More information about the Squeak-dev
mailing list
|