Login  Register

Re: Getting a user input string using Morphs

Posted by Stephan Eggermont-3 on Jun 12, 2015; 7:17am
URL: https://forum.world.st/Getting-a-user-input-string-using-Morphs-tp4831121p4831843.html

On 09-06-15 20:10, Hilaire wrote:
> I guess you tried with Pharo4.0.
> I did with 3.0

It is a difference between Workspace and GTPlayground.
In GTPlayground, ActiveEvent is nil, so it doesn't work.
In Workspace it works.

launchMiniEditor: evt

        | textMorph |
        hasFocus := true.  "Really only means edit in progress for this morph"
        textMorph := StringMorphEditor new contentsAsIs: contents.
        textMorph beAllFont: self fontToUse.
        textMorph bounds: (self bounds expandBy: 0@2).
        self addMorphFront: textMorph.
        evt hand newKeyboardFocus: textMorph.
        textMorph editor selectFrom: 1 to: textMorph paragraph text string size

replace evt hand by ActiveHand to make it work in GTPlayground.

Stephan