[BUG][FIX] ScrollPanes, please help!!
Steven Swerling
sswerling at yahoo.com
Mon May 3 17:51:10 UTC 2004
Attached is a fix that gets rid of an optimization that is no longer
needed, and in this case, causes a layout bug.
Explanation:
Hernan, you bumped into a line in ScrollPane>>extent: that exits the
method if it detects that the extent has not changed. In the case where
the morph is just starting up, this prevents it from properly laying out
its children.
I don't believe this optimization is necessary anymore -- when I first
wrote the hScrollbar code, I optimized this method to reduce the ammount
of overhead in setting scroll deltas, since adding another scrollbar had
the effect of doubling what was already a costly step, performance-wise.
Now that long lists use the PluggableListMorphOfMany (or can use it),
this optimization is no longer necessary.
Hernan Tylim wrote:
> Hi,
> Lately I am having a lot of trouble with PluggableTextMorphs and
> PluggableListMorphs. What happens is that they seem not to layout themselves
> properly. Note that this happens when they are put into the world. Later if
> you call #extent: on them, or it's owner, the text, the list and the
> scrollbars are put on the right place.
>
> Here are 2 snippets of code that you can use to reproduce the problem.
> Please tell me if I am doing something wrong.
>
> Example with a PluggableListMorph :
>
> | m plm |
> plm _ PluggableListMorph on: [(1 to: 20) collect: [:ea | ea asString]] list:
> #value selected: nil changeSelected: nil.
> plm
> color: Color blue muchLighter duller;
> hResizing: #spaceFill;
> vResizing: #spaceFill.
> m _ BorderedMorph new
> extent: 100 at 200;
> color: Color white;
> layoutInset: 10;
> layoutPolicy: TableLayout new;
> addMorph: plm;
> yourself.
> m openInHand.
>
> Example with a PluggableTextMorph :
>
> | m ptm |
> ptm _ PluggableTextMorph on: ['this string
> has
> many
> Cr
> so
> the PluggableTextMorph
> will have
> to use
> scrollbars
> to show it']
> text: #value accept: nil.
> ptm
> color: Color blue muchLighter duller;
> hResizing: #spaceFill;
> vResizing: #spaceFill.
> m _ BorderedMorph new
> extent: 100 at 200;
> color: Color white;
> layoutInset: 10;
> layoutPolicy: TableLayout new;
> addMorph: ptm;
> yourself.
> m openInHand.
>
> Thanks
>
> Regards,
> Hernán
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hScrollbarFixes3-sps.1.cs.gz
Type: application/gzip
Size: 627 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040503/09392967/hScrollbarFixes3-sps.1.cs.bin
More information about the Squeak-dev
mailing list
|