开发者

How do I get user input in the Self language?

开发者 https://www.devze.com 2023-01-10 06:28 出处:网络
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

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,开发者_如何学C or do I have to grok Mophic and build it from scratch?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消