Problem with text editor

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

Problem with text editor

4l3x
Hi,

I am trying to design my first GUI using text editor and input field. But I'm a bit confuse on how to append the user input text to text editor in the next line without replacing the current value of text editor.

Basically I'm trying to list all the user input from input field to the text editor, for example:

List of guest writer:
Lisa Lewis
Bert Hall
Sonya Gayle

Can I use WriteStream in my text editor method? Please give me some enlightenment. Thank you.

Regards,

Alex Chi




_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Problem with text editor

Herbert König
Hello Alex,


AC> I am trying to design my first GUI using text editor and
AC> input field. But I'm a bit confuse on how to append the user input
AC> text to text editor in the next line without replacing the current
AC> value of text editor.

this is not clear to me.

AC> Basically I'm trying to list all the user input from input
AC> field to the text editor, for example:

AC> List of guest writer:
AC> Lisa Lewis
AC> Bert Hall
AC> Sonya Gayle

This looks like you want to use a PluggableListMorph.
Search this list or the swiki for PluggableMorphsDemo.pr

AC> Can I use WriteStream in my text editor method? Please give
AC> me some enlightenment. Thank you.


Actually I do not understand what you mean by a text editor. But yes
for adding together lots of Strings Streams are a fast way.

But your example looks like you want a Collection of Strings.

If this doesn't help, please give some more examples.

--
Cheers,

Herbert  

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

RE: problem with text editor

4l3x
In reply to this post by 4l3x
Hi Herbert,

Sorry for not being so clear. I'm trying to design a GUI using input field where user will input their name and the other part of the GUI is like another text field to display all the list of user input.
Let's say user input name: Lisa and hit enter button,
the GUI will display:
List of user:
Lisa

If another user type in their name for example: Joan, then the screen will display:
List of user:
Lisa
Joan

I write the method on the enter button to display the text but the text is always replacing the old one instead of append it to the next line. Do you have any advise how to make this work? Thanks in advance.

Regards,

Alex
 

Hello Alex,


AC> I am trying to design my first GUI using text editor and
AC> input field. But I'm a bit confuse on how to append the user input
AC> text to text editor in the next line without replacing the current
AC> value of text editor.

this is not clear to me.

AC> Basically I'm trying to list all the user input from input
AC> field to the text editor, for example:

AC> List of guest writer:
AC> Lisa Lewis
AC> Bert Hall
AC> Sonya Gayle

This looks like you want to use a PluggableListMorph.
Search this list or the swiki for PluggableMorphsDemo.pr

AC> Can I use WriteStream in my text editor method? Please give
AC> me some enlightenment. Thank you.


Actually I do not understand what you mean by a text editor. But yes
for adding together lots of Strings Streams are a fast way.

But your example looks like you want a Collection of Strings.

If this doesn't help, please give some more examples.


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: RE: problem with text editor

Herbert König
Hello Alex,

AC> Let's say user input name: Lisa and hit enter button,
AC> the GUI will display:
AC> List of user:
AC> Lisa

AC> If another user type in their name for example: Joan, then the screen will display:
AC> List of user:
AC> Lisa
AC> Joan

AC> I write the method on the enter button to display the text
AC> but the text is always replacing the old one instead of append it
AC> to the next line. Do you have any advise how to make this work?
AC> Thanks in advance.

you will need a PluggableTextMorph. Actually this is not so simple,
the project I mentioned was a big help to me understanding this.

Imho what you will need is:
1- a model (not necessarily subclassed from Model) which has an
OrderedCollection of Strings plus an index on this collection if you
want to select from the list. This is where the users of your list end
up.

2- a PluggableListMorph to display the entries.

The model needs to provide three methods to plug into the
PluggableListMorph:
a- #usersList this just returns the collection of your users.
b- #userSelection which returns the aforementioned index
c- #userSelection: which sets this index and does whatever you want to
do if your list is clicked.

Then you build the listmorph like:
list := PluggableListMorph
          on: yourModel
          list: # usersList
          selected: #userSelection
          changeSelected: #userSelection:.

Took me a while to come to terms with this but now I use it all the
time.

I attached the UI of an app I use for billing time against my
customers. The button "New work" brings a FillInTheBlankMorph to get a
new entry. Clicking in the list fills the texts right of the list for
editing, Enter in one of the texts changes the list.

BTW the texts to edit are a subclass of StringButtonMorph where I only
changed mouseDown:

Actually it took some time for me to get familiar with Morphic UI
construction but now I like it.

I'm willing to help further after you've been through the
PluggableMorphsDemo.

Let me also mention UIEnhancements (I believe it's now called
Polymorph) which is about building Windoze like UI's (Gary Chambers is
the one) and easy morphic gui which is about graphical ui
construction. Sorry I only remember it was a french guy but I found it
quite impressive.



--
Cheers,

Herbert  
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners

DayfileUI.gif (6K) Download Attachment