Getting a user input string using Morphs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting a user input string using Morphs

Jigyasa Grover
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
Reply | Threaded
Open this post in threaded view
|

Re: Getting a user input string using Morphs

Max Leske

> On 09 Jun 2015, at 15:26, Jigyasa Grover <[hidden email]> wrote:
>
> 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.

The easiest (but probably not the prettiest) solution would be to use

input := UIManager default request: ‘please type something…’.

That will handle the dialog for you. Even if it’s not exactly what you need, you might get some idea of how to go about it. You should also look into how it’s done in other places (e.g. the Monticello browser).

Cheers,
Max

>
> Regards
>
>
>
> --
> View this message in context: http://forum.world.st/Getting-a-user-input-string-using-Morphs-tp4831122.html
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
>


Reply | Threaded
Open this post in threaded view
|

Re: Getting a user input string using Morphs

Jigyasa Grover
This post was updated on .
Hi Max :)

The alternative works the way I want, but it doesn't integrate well with the UI I have started to make with the help of Morphs.

PS- Can I use UIManager 'stuff' to make the entire GUI for my application ? Or should I find ways to get input from user using Morphs ?

Regards
Reply | Threaded
Open this post in threaded view
|

Re: Getting a user input string using Morphs

Peter Uhnak
If you don't need very specific control over the visuals of the UI I would highly recommend using Spec instead of Morphic.

As for search, you can do something like
~~~~~~~~~~~~~~~~~~~
arr := #('Pharo' 'Squeak' 'VisualWorks').

c := EntryCompletion new
dataSourceBlock: [ :currText | arr ];
filterBlock: [:currApplicant :currText | currApplicant includesSubstring: currText ].

m := TextInputFieldModel new.
m entryCompletion: c.

m openWithSpec
~~~~~~~~~~~~~~~~~~~

If you can describe in greater detail what exactly are you trying to achieve perhaps I would be able to give better hints.

Cheers,
Peter

On Tue, Jun 9, 2015 at 5:46 PM, Jigyasa Grover <[hidden email]> wrote:
Hi Max :)

The alternative works the way I want, but it doesn't integrate well with the
UI I have started to make with the help of Morphs.

PS- Can I use /UIManager/ 'stuff' to make the entire GUI for my application
?

Regards



--
View this message in context: http://forum.world.st/Getting-a-user-input-string-using-Morphs-tp4831122p4831220.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: Getting a user input string using Morphs

Jigyasa Grover
This post was updated on .
Hi Peter

I was planning to build something like this: