How do I find out the maximum extent that a morph can be set to, without this impacting the current extent of its owner morph?

Alexandre Rousseau alexr at mailsnare.net
Thu Nov 29 14:48:52 UTC 2007


Hi Edgar

Thanks very much. But what imagine that:

1. my text is much longer, say, 'A test is a test is a test is a test  
is a test is a test is a test is a test is a test is a test is a test  
is a test.'
2. the user has not yet resized my collapsed morph. Contents are  
contracted to, say, 32 characters, and copied to the title bar. So  
far, so good.
3. next, the user resizes the collapsed morph so that its length is  
twice what it was in #2. I would then want to be able to see more  
characters in that title bar, say, 64.

Actually, playing with ProjectViewMorphs, I see the behaviour I need.  
Say you name a project with a ridiculously long name. Collapsing the  
project view (in place) reveals only parts of the long title.  
Resizing it reveals or hides characters as needed.

Somehow, I can't get this to happen with my own collapsed morph.  
Delving into the ProjectViewMorph class does not shed much light on  
why this is happening, but I suspect that that project view's  
AlignmentMorph row plays a role in this. I'll do some tests.

Thanks for your help, again
Alex



On 29-Nov-07, at 9:43 PM, Edgar J. De Cleene wrote:

>
>
>
> El 11/29/07 10:03 AM, "Alexandre Rousseau" <alexr at mailsnare.net>  
> escribió:
>
>> Hi Edgar
>>
>>
>>> I following your previous post, trying to understand how should be
>>> constructed your morph.
>>>
>>> Until now, I think you wish some kind of Post It note, maybe I  
>>> wrong.
>>>
>>
>>
>> Yes, and that's working fine, for the most part (see attached
>> screenshot: note.gif).
>> ?
>> ?
>> ?
>>
>>>> 1. a SimpleButtonMorph, to trigger collapse/expansion of the  
>>>> stickie
>>>> note (collapsed = stickie note's editor submorph hidden)
>>>
>>> Why not change  collapsed/expanded state via click ?
>>>
>> Personal preference, but regardless of how, collapse works too. See
>> note-collapsed.gif.
>> ?
>> ?
>> ?
>>
>> As you can see from the screenshot, the collapsed note contains a
>> summary of its contents, obtained until now with this:
>>
>> NPNote>>updateSummaryLabel
>> self contents ifNotNil:
>> [(self summaryMorph)
>> contents: (self contents asString withSeparatorsCompacted
>> contractTo: (32 min: self contents size "NEED TO CHANGE THIS
>> CODE"))]
>>
>> What I would want to do instead is be able to get the maximum string
>> length that my summary can be set to without triggering a resize of
>> the title bar, hence the note. Right now, if I widen my note (via the
>> halo), my summary does not fill the title bar, i.e., note-collapsed-
>> wide.gif:
>> ?
>> ?
>> ?
>>
>>
>> I am not sure if this is clear enough. Also, I hope the size of this
>> email (20K) doesn't cause too much trouble.
>>
>> Thanks
>> Alex
>>
>>
>>
>>>> 2. a StringMorph that contains a summary -- a contracted copy -- of
>>>> the stickie note's editor's contents. I would like the length of  
>>>> that
>>>> summary to depend on the width of the stickie note's title bar.
>>>
>>> I could use a ScrollableField instead, like in old versions of 3.10.
>>> Now I embed into a SystemWindow  as some like more .
>>>
>>>> 3. a StringMorph instance that is set to the last modification date
>>>> of the stickie note.
>>> This is a very easy, you need a inst var like lastdate, and  
>>> appropiate
>>> senders and getters to #lastdate.
>>>
>>> Then this should be a submorph, and the children morph have
>>> comeToFront in
>>> his initialize
>>>
>>>> So, question: how do I determine the maximum space that #2 can  
>>>> occupy
>>>> before provoking a resize of the stickie note, and given that  
>>>> stickie
>>>> note widths are left to user discretion, i.e., can and will vary.
>>>
>>> If you send a example of full text, contracted text, maybe more
>>> help come.
>>>
>>> Edgar
>
>
>
>>>
> Alexandre :
>
> Very clear now, and you could put any pict as attached.
> The max size on this list is 100 k on newbies is only 40 k.
> The most easy way is changing name overriding #collapse , as you  
> could see
> in this very quick and dirty using current "history of 3.10 " as  
> example.
> You could see what if I change arbritray the name to "Pepe", the  
> collapsed
> label shows  only this four letters.
>
> If still unclear, send new mail.
>
>
> Edgar
>
> <Picture 3.png>




More information about the Squeak-dev mailing list