Getting a user input string using Morphs
Hi ! I am new to Pharo and am currently working on making an Offline Text Search Application. I plan to use Morphs to make a nice GUI. Initially, I had thought of using /TextMorphForEditView/ to get an input string from the user, but I feel this is not giving the desired functionality. Would be great if anyone could suggest a way to get input string from the user in the same window using an 'input text box' interface element. Regards -- View this message in context: http://forum.world.st/Getting-a-user-input-string-using-Morphs-tp4831121.htm... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
You can try and explore something like: *|| m ||** **|m := StringMorph contents: 'Edit me'.|** **|m openInWorld.|** **|m launchMiniEditor: ActiveEvent|* Hilaire Le 09/06/2015 15:25, Jigyasa Grover a écrit :
Hi !
I am new to Pharo and am currently working on making an Offline Text Search Application. I plan to use Morphs to make a nice GUI.
-- Dr. Geo http://drgeo.eu http://google.com/+DrgeoEu
Thanks HilaireFernandes But am afraid it gives the error " Message Not Understood: receiver of 'hand' is nil " . -- View this message in context: http://forum.world.st/Getting-a-user-input-string-using-Morphs-tp4831121p483... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Le 09/06/2015 18:04, Jigyasa Grover a écrit :
Thanks HilaireFernandes But am afraid it gives the error " Message Not Understood: receiver of 'hand' is nil " .
-- View this message in context: http://forum.world.st/Getting-a-user-input-string-using-Morphs-tp4831121p483... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
I guess you tried with Pharo4.0. I did with 3.0 -- Dr. Geo http://drgeo.eu http://google.com/+DrgeoEu
Yes I am currently developing it in Pharo 4.0 Thanks :) -- View this message in context: http://forum.world.st/Getting-a-user-input-string-using-Morphs-tp4831121p483... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
The needed change for this low level access to morph is probably a small one, related to ActiveHand, but I have not yet move to 4.0. In the other hand, you may want to use higher level approaches suggested by Pharo fellows. Hilaire Le 10/06/2015 09:20, Jigyasa Grover a écrit :
Yes I am currently developing it in Pharo 4.0
Thanks :)
-- Dr. Geo http://drgeo.eu http://google.com/+DrgeoEu
Yep, still exploring ... Thanks Jigyasa -- View this message in context: http://forum.world.st/Getting-a-user-input-string-using-Morphs-tp4831121p483... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Yes hilaire ActiveHand as a global is a "bad concept" In blog there is not globals anymore :) Le 10/6/15 10:54, Hilaire a écrit :
The needed change for this low level access to morph is probably a small one, related to ActiveHand, but I have not yet move to 4.0. In the other hand, you may want to use higher level approaches suggested by Pharo fellows.
Hilaire
Le 10/06/2015 09:20, Jigyasa Grover a écrit :
Yes I am currently developing it in Pharo 4.0
Thanks :)
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
participants (4)
-
Hilaire -
Jigyasa Grover -
Stephan Eggermont -
stepharo