Aw: Re: TextMorph

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

Aw: Re: TextMorph

pascal.vollmer
 Hi Mark,

Thanks for your advice. But the behavior I experience seems not to depend on extent:.
Let me show an example:

1.) a := TextMorph borderedPrototype. a openInWorld.
2.) b := TextMorph borderedPrototype. b newContents: ''; openInWorld.

1.) shows a text 'abc' with big font. When getting focus you will see a big cursor. You may start to change it.
2.) shows nothing. When getting focus you will see a small cursor. And when you start to change it you will see small font text.

This does not change when you add b extent: 100@100.

There is an additional observation. If you take code snippet 1.) and edit it you will loose vertical size of cursor and text when you walk from 1 character to 0 character and 1 character again. But pay attention: this is true for character deletion with the Del-key. It is not true for the Backspace-key.

If anyone can give me a clue on this I would be grateful. You may find my TimesTable app on SqueakSource.

Kind regards
Pascal



----- Original Nachricht ----
Von:     Mark Volkmann <[hidden email]>
An:      "A friendly place to get answers to even the most basic questions about
        Squeak." <[hidden email]>
Datum:   04.11.2008 00:00
Betreff: Re: [Newbies] TextMorph

> On Nov 3, 2008, at 4:51 PM, [hidden email] wrote:
>
> > Hello,
> >
> > I write a times table application for children: a question, an  
> > equals sign, an answer. For the answer field I would like to see a  
> > TextMorph. It should be empty, prepared for big size figures and  
> > with a big size cursor waiting for input.
> >
> > I tested TextMorph>>borderedPrototype the contents of which is  
> > initialized to 'abc'. Now, when I change 'abc' to an empty string...  
> > cursor size is reduced and the first figure that is typed by the  
> > user will be small size.
> >
> > Why this different behavior?
>
>
> I think the issue is that if you want the TextMorph to be larger than  
> the text inside it (in your case none), you have to set its extent.  
> Here's some code that works for me. Note how I set the extent height  
> of "textField" based on the font size of the StringMorph. I set the  
> extent width to a fixed value of 100 pixels.
>
> spaceBetweenMorphs := 10.
> spaceInsideContainer := 10.
>
> container := Morph new.
> container
> layoutPolicy: TableLayout new;
> listDirection: #leftToRight;
> hResizing: #shrinkWrap;
> vResizing: #shrinkWrap;
> layoutInset: spaceInsideContainer;
> cellInset: spaceBetweenMorphs;
> width: 200.
>
> label := StringMorph contents: 'I''m a label.'.
> font := label font.
> margin := 4.
> height := font lineGrid + (margin * 2).
> container addMorphBack: label.
>
> textField := TextFieldMorph new.
> textField extent: 100@height. "text doesn't display if insufficient  
> height"
> container addMorphBack: textField.
>
> ---
> Mark Volkmann
>
>
>
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>

Pascal Vollmer
Email: [hidden email]

Jetzt komfortabel bei Arcor-Digital TV einsteigen: Mehr Happy Ends, mehr Herzschmerz, mehr Fernsehen! Erleben Sie 50 digitale TV Programme und optional 60 Pay TV Sender, einen elektronischen Programmführer mit Movie Star Bewertungen von TV Movie. Außerdem, aktuelle Filmhits und spannende Dokus in der Arcor-Videothek. Infos unter www.arcor.de/tv
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Aw: Re: TextMorph

Mark Volkmann
I'm not familiar with the borderedPrototype or newContents: methods.
The following works for me without setting the extent. You should see  
the string 'foo' displayed.

t := TextMorph new
        contents: 'foo';
        position: 800@400;
        openInWorld;
        yourself

On Nov 4, 2008, at 2:52 AM, [hidden email] wrote:

> Hi Mark,
>
> Thanks for your advice. But the behavior I experience seems not to  
> depend on extent:.
> Let me show an example:
>
> 1.) a := TextMorph borderedPrototype. a openInWorld.
> 2.) b := TextMorph borderedPrototype. b newContents: ''; openInWorld.
>
> 1.) shows a text 'abc' with big font. When getting focus you will  
> see a big cursor. You may start to change it.
> 2.) shows nothing. When getting focus you will see a small cursor.  
> And when you start to change it you will see small font text.
>
> This does not change when you add b extent: 100@100.
>
> There is an additional observation. If you take code snippet 1.) and  
> edit it you will loose vertical size of cursor and text when you  
> walk from 1 character to 0 character and 1 character again. But pay  
> attention: this is true for character deletion with the Del-key. It  
> is not true for the Backspace-key.
>
> If anyone can give me a clue on this I would be grateful. You may  
> find my TimesTable app on SqueakSource.
>
> Kind regards
> Pascal
>
>
>
> ----- Original Nachricht ----
> Von:     Mark Volkmann <[hidden email]>
> An:      "A friendly place to get answers to even the most basic  
> questions about
> Squeak." <[hidden email]>
> Datum:   04.11.2008 00:00
> Betreff: Re: [Newbies] TextMorph
>
>> On Nov 3, 2008, at 4:51 PM, [hidden email] wrote:
>>
>>> Hello,
>>>
>>> I write a times table application for children: a question, an
>>> equals sign, an answer. For the answer field I would like to see a
>>> TextMorph. It should be empty, prepared for big size figures and
>>> with a big size cursor waiting for input.
>>>
>>> I tested TextMorph>>borderedPrototype the contents of which is
>>> initialized to 'abc'. Now, when I change 'abc' to an empty string...
>>> cursor size is reduced and the first figure that is typed by the
>>> user will be small size.
>>>
>>> Why this different behavior?
>>
>>
>> I think the issue is that if you want the TextMorph to be larger than
>> the text inside it (in your case none), you have to set its extent.
>> Here's some code that works for me. Note how I set the extent height
>> of "textField" based on the font size of the StringMorph. I set the
>> extent width to a fixed value of 100 pixels.
>>
>> spaceBetweenMorphs := 10.
>> spaceInsideContainer := 10.
>>
>> container := Morph new.
>> container
>> layoutPolicy: TableLayout new;
>> listDirection: #leftToRight;
>> hResizing: #shrinkWrap;
>> vResizing: #shrinkWrap;
>> layoutInset: spaceInsideContainer;
>> cellInset: spaceBetweenMorphs;
>> width: 200.
>>
>> label := StringMorph contents: 'I''m a label.'.
>> font := label font.
>> margin := 4.
>> height := font lineGrid + (margin * 2).
>> container addMorphBack: label.
>>
>> textField := TextFieldMorph new.
>> textField extent: 100@height. "text doesn't display if insufficient
>> height"
>> container addMorphBack: textField.
>>
>> ---
>> Mark Volkmann
>>
>>
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
>
> Pascal Vollmer
> Email: [hidden email]
>
> Jetzt komfortabel bei Arcor-Digital TV einsteigen: Mehr Happy Ends,  
> mehr Herzschmerz, mehr Fernsehen! Erleben Sie 50 digitale TV  
> Programme und optional 60 Pay TV Sender, einen elektronischen  
> Programmführer mit Movie Star Bewertungen von TV Movie. Außerdem,  
> aktuelle Filmhits und spannende Dokus in der Arcor-Videothek. Infos  
> unter www.arcor.de/tv
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners


---
Mark Volkmann




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

Aw: Re: Aw: Re: TextMorph

pascal.vollmer
 Hi Mark,

what you show is ok. But my problem is different.

Imagine a child in front of a timestable application.
She sees a question ("8 x 3 =") and there is another field where she is supposed to type the answer (a TextMorph).

The answer field is supposed to be empty except for a cursor indicating that you may type your answer here.
When typed, the figures are supposed to appear in a big font size.

My problem: Until now I did not succeed to initialize a TextMorph in a way that fulfills my requirements.

Kind regards
Pascal


----- Original Nachricht ----
Von:     Mark Volkmann <[hidden email]>
An:      "A friendly place to get answers to even the most basic questions about
        Squeak." <[hidden email]>
Datum:   04.11.2008 12:59
Betreff: Re: Aw: Re: [Newbies] TextMorph

> I'm not familiar with the borderedPrototype or newContents: methods.
> The following works for me without setting the extent. You should see  
> the string 'foo' displayed.
>
> t := TextMorph new
> contents: 'foo';
> position: 800@400;
> openInWorld;
> yourself
>
> On Nov 4, 2008, at 2:52 AM, [hidden email] wrote:
>
> > Hi Mark,
> >
> > Thanks for your advice. But the behavior I experience seems not to  
> > depend on extent:.
> > Let me show an example:
> >
> > 1.) a := TextMorph borderedPrototype. a openInWorld.
> > 2.) b := TextMorph borderedPrototype. b newContents: ''; openInWorld.
> >
> > 1.) shows a text 'abc' with big font. When getting focus you will  
> > see a big cursor. You may start to change it.
> > 2.) shows nothing. When getting focus you will see a small cursor.  
> > And when you start to change it you will see small font text.
> >
> > This does not change when you add b extent: 100@100.
> >
> > There is an additional observation. If you take code snippet 1.) and  
> > edit it you will loose vertical size of cursor and text when you  
> > walk from 1 character to 0 character and 1 character again. But pay  
> > attention: this is true for character deletion with the Del-key. It  
> > is not true for the Backspace-key.
> >
> > If anyone can give me a clue on this I would be grateful. You may  
> > find my TimesTable app on SqueakSource.
> >
> > Kind regards
> > Pascal
> >
> >
> >
> > ----- Original Nachricht ----
> > Von:     Mark Volkmann <[hidden email]>
> > An:      "A friendly place to get answers to even the most basic  
> > questions about
> > Squeak." <[hidden email]>
> > Datum:   04.11.2008 00:00
> > Betreff: Re: [Newbies] TextMorph
> >
> >> On Nov 3, 2008, at 4:51 PM, [hidden email] wrote:
> >>
> >>> Hello,
> >>>
> >>> I write a times table application for children: a question, an
> >>> equals sign, an answer. For the answer field I would like to see a
> >>> TextMorph. It should be empty, prepared for big size figures and
> >>> with a big size cursor waiting for input.
> >>>
> >>> I tested TextMorph>>borderedPrototype the contents of which is
> >>> initialized to 'abc'. Now, when I change 'abc' to an empty string...
> >>> cursor size is reduced and the first figure that is typed by the
> >>> user will be small size.
> >>>
> >>> Why this different behavior?
> >>
> >>
> >> I think the issue is that if you want the TextMorph to be larger than
> >> the text inside it (in your case none), you have to set its extent.
> >> Here's some code that works for me. Note how I set the extent height
> >> of "textField" based on the font size of the StringMorph. I set the
> >> extent width to a fixed value of 100 pixels.
> >>
> >> spaceBetweenMorphs := 10.
> >> spaceInsideContainer := 10.
> >>
> >> container := Morph new.
> >> container
> >> layoutPolicy: TableLayout new;
> >> listDirection: #leftToRight;
> >> hResizing: #shrinkWrap;
> >> vResizing: #shrinkWrap;
> >> layoutInset: spaceInsideContainer;
> >> cellInset: spaceBetweenMorphs;
> >> width: 200.
> >>
> >> label := StringMorph contents: 'I''m a label.'.
> >> font := label font.
> >> margin := 4.
> >> height := font lineGrid + (margin * 2).
> >> container addMorphBack: label.
> >>
> >> textField := TextFieldMorph new.
> >> textField extent: 100@height. "text doesn't display if insufficient
> >> height"
> >> container addMorphBack: textField.
> >>
> >> ---
> >> Mark Volkmann
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> Beginners mailing list
> >> [hidden email]
> >> http://lists.squeakfoundation.org/mailman/listinfo/beginners
> >>
> >
> > Pascal Vollmer
> > Email: [hidden email]
> >
> > Jetzt komfortabel bei Arcor-Digital TV einsteigen: Mehr Happy Ends,  
> > mehr Herzschmerz, mehr Fernsehen! Erleben Sie 50 digitale TV  
> > Programme und optional 60 Pay TV Sender, einen elektronischen  
> > Programmführer mit Movie Star Bewertungen von TV Movie. Außerdem,  
> > aktuelle Filmhits und spannende Dokus in der Arcor-Videothek. Infos  
> > unter www.arcor.de/tv
> > _______________________________________________
> > Beginners mailing list
> > [hidden email]
> > http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
> ---
> Mark Volkmann
>
>
>
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>

Pascal Vollmer
Email: [hidden email]

Jetzt komfortabel bei Arcor-Digital TV einsteigen: Mehr Happy Ends, mehr Herzschmerz, mehr Fernsehen! Erleben Sie 50 digitale TV Programme und optional 60 Pay TV Sender, einen elektronischen Programmführer mit Movie Star Bewertungen von TV Movie. Außerdem, aktuelle Filmhits und spannende Dokus in der Arcor-Videothek. Infos unter www.arcor.de/tv
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Aw: Re: Aw: Re: TextMorph

Mark Volkmann
I'm still learning about Morphic too. I tried to create what you are  
trying to do and that raised more questions. Here's what I have.





The first TextMorph starts empty. I typed "xyz" into it. The second  
one just has the default contents of "abc".
Why does the text in the first one appear at the bottom instead of  
where the text appears in the second one?

When I click in one of the text fields, a dotted line appears just  
inside the border of the TextMorph to show that it has focus. When I  
press the tab key, focus doesn't move to the other one. How can I set  
that up?
How can I make the first TextMorph have the focus as soon as I start  
the application?

How can execute a block or send a message when the user presses the  
enter/return key while focus is in a TextMorph?

Here's my code so far ... a rudimentary start that I'll factor into  
additional methods once I understand how to get things working. I just  
have one method, initialize, in a class named MathQuiz. To run it I  
enter "MathQuiz new" in a workspace and do-it.

initialize
        | container textField |
       
        textField := TextFieldMorph new
                contents: '';
                extent: 40@30;
                yourself.

        container := Morph new.
       
        container
                cellInset: 10;
                layoutInset: 10;
                layoutPolicy: TableLayout new;
                listDirection: #leftToRight.
               
        container addMorphBack: (StringMorph contents: '8').
        container addMorphBack: (StringMorph contents: 'x').
        container addMorphBack: (StringMorph contents: '3').
        container addMorphBack: (StringMorph contents: '=').
        container addMorphBack: textField.
        container addMorphBack: (TextFieldMorph new extent: 40@30; yourself).

        container openInWindowLabeled: 'Math Quiz'

On Nov 4, 2008, at 10:14 AM, [hidden email] wrote:

> Hi Mark,
>
> what you show is ok. But my problem is different.
>
> Imagine a child in front of a timestable application.
> She sees a question ("8 x 3 =") and there is another field where she  
> is supposed to type the answer (a TextMorph).
>
> The answer field is supposed to be empty except for a cursor  
> indicating that you may type your answer here.
> When typed, the figures are supposed to appear in a big font size.
>
> My problem: Until now I did not succeed to initialize a TextMorph in  
> a way that fulfills my requirements.
>
> Kind regards
> Pascal
>
>
> ----- Original Nachricht ----
> Von:     Mark Volkmann <[hidden email]>
> An:      "A friendly place to get answers to even the most basic  
> questions about
> Squeak." <[hidden email]>
> Datum:   04.11.2008 12:59
> Betreff: Re: Aw: Re: [Newbies] TextMorph
>
>> I'm not familiar with the borderedPrototype or newContents: methods.
>> The following works for me without setting the extent. You should see
>> the string 'foo' displayed.
>>
>> t := TextMorph new
>> contents: 'foo';
>> position: 800@400;
>> openInWorld;
>> yourself
>>
>> On Nov 4, 2008, at 2:52 AM, [hidden email] wrote:
>>
>>> Hi Mark,
>>>
>>> Thanks for your advice. But the behavior I experience seems not to
>>> depend on extent:.
>>> Let me show an example:
>>>
>>> 1.) a := TextMorph borderedPrototype. a openInWorld.
>>> 2.) b := TextMorph borderedPrototype. b newContents: '';  
>>> openInWorld.
>>>
>>> 1.) shows a text 'abc' with big font. When getting focus you will
>>> see a big cursor. You may start to change it.
>>> 2.) shows nothing. When getting focus you will see a small cursor.
>>> And when you start to change it you will see small font text.
>>>
>>> This does not change when you add b extent: 100@100.
>>>
>>> There is an additional observation. If you take code snippet 1.) and
>>> edit it you will loose vertical size of cursor and text when you
>>> walk from 1 character to 0 character and 1 character again. But pay
>>> attention: this is true for character deletion with the Del-key. It
>>> is not true for the Backspace-key.
>>>
>>> If anyone can give me a clue on this I would be grateful. You may
>>> find my TimesTable app on SqueakSource.
>>>
>>> Kind regards
>>> Pascal
>>>
>>>
>>>
>>> ----- Original Nachricht ----
>>> Von:     Mark Volkmann <[hidden email]>
>>> An:      "A friendly place to get answers to even the most basic
>>> questions about
>>> Squeak." <[hidden email]>
>>> Datum:   04.11.2008 00:00
>>> Betreff: Re: [Newbies] TextMorph
>>>
>>>> On Nov 3, 2008, at 4:51 PM, [hidden email] wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I write a times table application for children: a question, an
>>>>> equals sign, an answer. For the answer field I would like to see a
>>>>> TextMorph. It should be empty, prepared for big size figures and
>>>>> with a big size cursor waiting for input.
>>>>>
>>>>> I tested TextMorph>>borderedPrototype the contents of which is
>>>>> initialized to 'abc'. Now, when I change 'abc' to an empty  
>>>>> string...
>>>>> cursor size is reduced and the first figure that is typed by the
>>>>> user will be small size.
>>>>>
>>>>> Why this different behavior?
>>>>
>>>>
>>>> I think the issue is that if you want the TextMorph to be larger  
>>>> than
>>>> the text inside it (in your case none), you have to set its extent.
>>>> Here's some code that works for me. Note how I set the extent  
>>>> height
>>>> of "textField" based on the font size of the StringMorph. I set the
>>>> extent width to a fixed value of 100 pixels.
>>>>
>>>> spaceBetweenMorphs := 10.
>>>> spaceInsideContainer := 10.
>>>>
>>>> container := Morph new.
>>>> container
>>>> layoutPolicy: TableLayout new;
>>>> listDirection: #leftToRight;
>>>> hResizing: #shrinkWrap;
>>>> vResizing: #shrinkWrap;
>>>> layoutInset: spaceInsideContainer;
>>>> cellInset: spaceBetweenMorphs;
>>>> width: 200.
>>>>
>>>> label := StringMorph contents: 'I''m a label.'.
>>>> font := label font.
>>>> margin := 4.
>>>> height := font lineGrid + (margin * 2).
>>>> container addMorphBack: label.
>>>>
>>>> textField := TextFieldMorph new.
>>>> textField extent: 100@height. "text doesn't display if  
>>>> insufficient
>>>> height"
>>>> container addMorphBack: textField.
>>>>
>>>> ---
>>>> Mark Volkmann
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Beginners mailing list
>>>> [hidden email]
>>>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>>>
>>>
>>> Pascal Vollmer
>>> Email: [hidden email]
>>>
>>> Jetzt komfortabel bei Arcor-Digital TV einsteigen: Mehr Happy Ends,
>>> mehr Herzschmerz, mehr Fernsehen! Erleben Sie 50 digitale TV
>>> Programme und optional 60 Pay TV Sender, einen elektronischen
>>> Programmführer mit Movie Star Bewertungen von TV Movie. Außerdem,
>>> aktuelle Filmhits und spannende Dokus in der Arcor-Videothek. Infos
>>> unter www.arcor.de/tv
>>> _______________________________________________
>>> Beginners mailing list
>>> [hidden email]
>>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
>>
>> ---
>> Mark Volkmann
>>
>>
>>
>>
>> _______________________________________________
>> Beginners mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
>
> Pascal Vollmer
> Email: [hidden email]
>
> Jetzt komfortabel bei Arcor-Digital TV einsteigen: Mehr Happy Ends,  
> mehr Herzschmerz, mehr Fernsehen! Erleben Sie 50 digitale TV  
> Programme und optional 60 Pay TV Sender, einen elektronischen  
> Programmführer mit Movie Star Bewertungen von TV Movie. Außerdem,  
> aktuelle Filmhits und spannende Dokus in der Arcor-Videothek. Infos  
> unter www.arcor.de/tv
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

---
Mark Volkmann





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

pastedGraphic.png (11K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Aw: Re: Aw: Re: Aw: Re: TextMorph

pascal.vollmer
 Hi Mark,

a partial answer to your questions (see code in: SqueakSource/TimesTable):

1) tab key to move focus: don't know how to get this behavior,
2) direct keyboard focus to a Morph immediately when starting: see EinMalEins>>step,
3) CR-key in focussed Morph triggers message: see EinMalEins>>setAnswerMorph.

For further information see the comment of class EinMalEins.
To start app say: EinMalEins new openInWorld.

Kind regards
Pascal


----- Original Nachricht ----
Von:     Mark Volkmann <[hidden email]>
An:      "A friendly place to get answers to even the most basic questions about
        Squeak." <[hidden email]>
Datum:   04.11.2008 18:19
Betreff: Re: Aw: Re: Aw: Re: [Newbies] TextMorph

> I'm still learning about Morphic too. I tried to create what you are  
> trying to do and that raised more questions. Here's what I have.
>
>
>
> --------------------------------
>
>
>
>
> The first TextMorph starts empty. I typed "xyz" into it. The second  
> one just has the default contents of "abc".
> Why does the text in the first one appear at the bottom instead of  
> where the text appears in the second one?
>
> When I click in one of the text fields, a dotted line appears just  
> inside the border of the TextMorph to show that it has focus. When I  
> press the tab key, focus doesn't move to the other one. How can I set  
> that up?
> How can I make the first TextMorph have the focus as soon as I start  
> the application?
>
> How can execute a block or send a message when the user presses the  
> enter/return key while focus is in a TextMorph?
>
> Here's my code so far ... a rudimentary start that I'll factor into  
> additional methods once I understand how to get things working. I just  
> have one method, initialize, in a class named MathQuiz. To run it I  
> enter "MathQuiz new" in a workspace and do-it.
>
> initialize
> | container textField |
>
> textField := TextFieldMorph new
> contents: '';
> extent: 40@30;
> yourself.
>
> container := Morph new.
>
> container
> cellInset: 10;
> layoutInset: 10;
> layoutPolicy: TableLayout new;
> listDirection: #leftToRight.
>
> container addMorphBack: (StringMorph contents: '8').
> container addMorphBack: (StringMorph contents: 'x').
> container addMorphBack: (StringMorph contents: '3').
> container addMorphBack: (StringMorph contents: '=').
> container addMorphBack: textField.
> container addMorphBack: (TextFieldMorph new extent: 40@30; yourself).
>
> container openInWindowLabeled: 'Math Quiz'
>
> On Nov 4, 2008, at 10:14 AM, [hidden email] wrote:
>
> > Hi Mark,
> >
> > what you show is ok. But my problem is different.
> >
> > Imagine a child in front of a timestable application.
> > She sees a question ("8 x 3 =") and there is another field where she  
> > is supposed to type the answer (a TextMorph).
> >
> > The answer field is supposed to be empty except for a cursor  
> > indicating that you may type your answer here.
> > When typed, the figures are supposed to appear in a big font size.
> >
> > My problem: Until now I did not succeed to initialize a TextMorph in  
> > a way that fulfills my requirements.
> >
> > Kind regards
> > Pascal
> >
> >
> > ----- Original Nachricht ----
> > Von:     Mark Volkmann <[hidden email]>
> > An:      "A friendly place to get answers to even the most basic  
> > questions about
> > Squeak." <[hidden email]>
> > Datum:   04.11.2008 12:59
> > Betreff: Re: Aw: Re: [Newbies] TextMorph
> >
> >> I'm not familiar with the borderedPrototype or newContents: methods.
> >> The following works for me without setting the extent. You should see
> >> the string 'foo' displayed.
> >>
> >> t := TextMorph new
> >> contents: 'foo';
> >> position: 800@400;
> >> openInWorld;
> >> yourself
> >>
> >> On Nov 4, 2008, at 2:52 AM, [hidden email] wrote:
> >>
> >>> Hi Mark,
> >>>
> >>> Thanks for your advice. But the behavior I experience seems not to
> >>> depend on extent:.
> >>> Let me show an example:
> >>>
> >>> 1.) a := TextMorph borderedPrototype. a openInWorld.
> >>> 2.) b := TextMorph borderedPrototype. b newContents: '';  
> >>> openInWorld.
> >>>
> >>> 1.) shows a text 'abc' with big font. When getting focus you will
> >>> see a big cursor. You may start to change it.
> >>> 2.) shows nothing. When getting focus you will see a small cursor.
> >>> And when you start to change it you will see small font text.
> >>>
> >>> This does not change when you add b extent: 100@100.
> >>>
> >>> There is an additional observation. If you take code snippet 1.) and
> >>> edit it you will loose vertical size of cursor and text when you
> >>> walk from 1 character to 0 character and 1 character again. But pay
> >>> attention: this is true for character deletion with the Del-key. It
> >>> is not true for the Backspace-key.
> >>>
> >>> If anyone can give me a clue on this I would be grateful. You may
> >>> find my TimesTable app on SqueakSource.
> >>>
> >>> Kind regards
> >>> Pascal
> >>>
> >>>
> >>>
> >>> ----- Original Nachricht ----
> >>> Von:     Mark Volkmann <[hidden email]>
> >>> An:      "A friendly place to get answers to even the most basic
> >>> questions about
> >>> Squeak." <[hidden email]>
> >>> Datum:   04.11.2008 00:00
> >>> Betreff: Re: [Newbies] TextMorph
> >>>
> >>>> On Nov 3, 2008, at 4:51 PM, [hidden email] wrote:
> >>>>
> >>>>> Hello,
> >>>>>
> >>>>> I write a times table application for children: a question, an
> >>>>> equals sign, an answer. For the answer field I would like to see a
> >>>>> TextMorph. It should be empty, prepared for big size figures and
> >>>>> with a big size cursor waiting for input.
> >>>>>
> >>>>> I tested TextMorph>>borderedPrototype the contents of which is
> >>>>> initialized to 'abc'. Now, when I change 'abc' to an empty  
> >>>>> string...
> >>>>> cursor size is reduced and the first figure that is typed by the
> >>>>> user will be small size.
> >>>>>
> >>>>> Why this different behavior?
> >>>>
> >>>>
> >>>> I think the issue is that if you want the TextMorph to be larger  
> >>>> than
> >>>> the text inside it (in your case none), you have to set its extent.
> >>>> Here's some code that works for me. Note how I set the extent  
> >>>> height
> >>>> of "textField" based on the font size of the StringMorph. I set the
> >>>> extent width to a fixed value of 100 pixels.
> >>>>
> >>>> spaceBetweenMorphs := 10.
> >>>> spaceInsideContainer := 10.
> >>>>
> >>>> container := Morph new.
> >>>> container
> >>>> layoutPolicy: TableLayout new;
> >>>> listDirection: #leftToRight;
> >>>> hResizing: #shrinkWrap;
> >>>> vResizing: #shrinkWrap;
> >>>> layoutInset: spaceInsideContainer;
> >>>> cellInset: spaceBetweenMorphs;
> >>>> width: 200.
> >>>>
> >>>> label := StringMorph contents: 'I''m a label.'.
> >>>> font := label font.
> >>>> margin := 4.
> >>>> height := font lineGrid + (margin * 2).
> >>>> container addMorphBack: label.
> >>>>
> >>>> textField := TextFieldMorph new.
> >>>> textField extent: 100@height. "text doesn't display if  
> >>>> insufficient
> >>>> height"
> >>>> container addMorphBack: textField.
> >>>>
> >>>> ---
> >>>> Mark Volkmann
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> Beginners mailing list
> >>>> [hidden email]
> >>>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
> >>>>
> >>>
> >>> Pascal Vollmer
> >>> Email: [hidden email]
> >>>
> >>> Jetzt komfortabel bei Arcor-Digital TV einsteigen: Mehr Happy Ends,
> >>> mehr Herzschmerz, mehr Fernsehen! Erleben Sie 50 digitale TV
> >>> Programme und optional 60 Pay TV Sender, einen elektronischen
> >>> Programmführer mit Movie Star Bewertungen von TV Movie. Außerdem,
> >>> aktuelle Filmhits und spannende Dokus in der Arcor-Videothek. Infos
> >>> unter www.arcor.de/tv
> >>> _______________________________________________
> >>> Beginners mailing list
> >>> [hidden email]
> >>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
> >>
> >>
> >> ---
> >> Mark Volkmann
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> Beginners mailing list
> >> [hidden email]
> >> http://lists.squeakfoundation.org/mailman/listinfo/beginners
> >>
> >
> > Pascal Vollmer
> > Email: [hidden email]
> >
> > Jetzt komfortabel bei Arcor-Digital TV einsteigen: Mehr Happy Ends,  
> > mehr Herzschmerz, mehr Fernsehen! Erleben Sie 50 digitale TV  
> > Programme und optional 60 Pay TV Sender, einen elektronischen  
> > Programmführer mit Movie Star Bewertungen von TV Movie. Außerdem,  
> > aktuelle Filmhits und spannende Dokus in der Arcor-Videothek. Infos  
> > unter www.arcor.de/tv
> > _______________________________________________
> > Beginners mailing list
> > [hidden email]
> > http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
>
> ---
> Mark Volkmann
>
>
>
>
>
>
> --------------------------------
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>

Pascal Vollmer
Email: [hidden email]

Jetzt komfortabel bei Arcor-Digital TV einsteigen: Mehr Happy Ends, mehr Herzschmerz, mehr Fernsehen! Erleben Sie 50 digitale TV Programme und optional 60 Pay TV Sender, einen elektronischen Programmführer mit Movie Star Bewertungen von TV Movie. Außerdem, aktuelle Filmhits und spannende Dokus in der Arcor-Videothek. Infos unter www.arcor.de/tv
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Aw: Re: Aw: Re: Aw: Re: TextMorph

Herbert König
Hi Pascal and Mark,

first, I've noticed the size changing behaviour in TextMorph too.

I wanted a text which would start editing on single click and apply
its changes on Enter key or on loss of focus.

In my (years old) application I subclassed StringButtonMorph (which
looks like a text not like a Button) and changed mouseDown: (read the
comments!).

pvnd> starting: see EinMalEins>>step,

My class comment suggests I was not happy with stepping.

If you need help how to plug this into a model, come back.

--
Cheers,

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

EditableStringButtonMorph.st (2K) Download Attachment