[FIX] Re: [BUG][?] #position: and #layoutChanged

Henrik Gedenryd Henrik.Gedenryd at lucs.lu.se
Mon Jan 17 11:12:26 UTC 2000


This fix is hardly worth the name.

Bob Arning wrote:

> but, curiously enough, if you change a morph's position (Morph>>position:) no
> #layoutChanged is sent, hence the owner may never know that his fullBounds may
> need fixing. I found that adding "self layoutChanged" to Morph>>position:
> allowed me to remove the two-line kludge in #positionCellMorphs without ill
> effect. While I don't know how to recreate the situation, I suspect it may fix
> Mike's problem as well.
> 
> So, the question is: Is there a reason that Morph>>position: does *not* send
> #layoutChanged?

Bob,
I have noted the same thing; it was a complete double take for me, because
of the very comment in layoutChanged:

"Note that something has changed about the size, shape, or location of the
receiver or one of its submorphs, so that fullBounds must be recomputed."

I sent a mail to Dan about it, hedging that I probably had missed something
obvious--I didn't want to embarass myself in front of the whole list :) It
probably got lost among the moving boxes with dinnerware, but I hadn't even
thought about it until now, since I've used the following fix for a month or
two now, and it has caused me no trouble, but seems to do its thing (adding
the last line only):

position: aPoint
    "Change the position of this morph and and all of its submorphs."

    | delta |
    delta _ aPoint - bounds topLeft.
    (delta x = 0 and: [delta y = 0]) ifTrue: [^ self].  "Null change"
    self changed.
    self privateFullMoveBy: delta.
    self changed;
         layoutChanged.

(What a clever solution of me to come up with! ;)

What puzzles me is that if this bug has been there for so long, how come it
hasn't been causing trouble so it was noticed; it seems that moving morphs
is sorta fundamental!

Henrik

< = > .






More information about the Squeak-dev mailing list