Justin Love
Justin Love

Reputation: 4457

How do I get user input in the Self language?

I'm experimenting with the Self language and I just past the point of easy canned stuff. I want to prompt the user for a number, or perhaps provide a form for several numbers. Is there an equivalent to a scripting language's stdin-input, or a simple dialog, or do I have to grok Mophic and build it from scratch?

Upvotes: 1

Views: 174

Answers (1)

Bernd Elkemann
Bernd Elkemann

Reputation: 23550

Morphic is available in Squeak too.

Find any Morph in which Text can be entered (doesnt matter if single/multi-lined), middle-click it, clone it and create a reference to it. Then, for that object implement #keyUp:evt. The message that invokes this method is sent when the user releases a key on his keyboard when this Morph has the keyboard-focus. In the method you can get the text contained in the Morph and parse it.

Upvotes: 2

Related Questions