[squeak-dev] Morphic equivalent of 'display: none'?

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Fri Apr 3 17:08:12 UTC 2020


Perfect! Thanks, Marcel! :-)


Best,

Christoph

________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Freitag, 3. April 2020 18:59:44
An: John Pfersich via Squeak-dev
Betreff: Re: [squeak-dev] Morphic equivalent of 'display: none'?

Hi!

Yes, there is:

aMorph
   disableLayout: true;
   visible: false.

Best,
Marcel

Am 03.04.2020 17:48:29 schrieb Stéphane Rollandin <lecteur at zogotounga.net>:

> #show/#hide/#visible: reserve space for the hidden morph. However, there
> are other scenarios where you do not want to reserve space. (A simple
> example would be a list that should only appear iff it has items.)

You could have such a "removed morph" temporarily #become: a collapsed
representation (like a flat invisible morph for a list item), and then
swap it back when you need it. I have used that pattern; #become: is fast.

>
> In JS, you can use 'display: none' instead of 'visibility: hidden' to
> give the space back to the element's remaining siblings.
>
> But in Morphic, is there currently any better option than #delete (and
> #addMorph:) later?
>
>
> (IMO, delete'n'add is not always the best pattern to do this. You
> need to remember the index and owner of the relevant morph for adding it
> later.)
>
>
> Provided that I did not overlook any existing features, would you
> consider this a useful extension for Morphic?

No. I think this should be implemented either via specific mophs or via
specific layout (probably yet to be invented).

>
> I was thinking of a property (#skipLayout, if you do not have any better
> idea) and a convenience method (#nonSkippedSubmorphs) that
> rejects suppressed submorphs. TableLayout would need to use this
> selector instead of regular #submorphs.
>
> Or would this break too many existing things that rely on #submorphs?

Oh, yes, please do not add any logic to #submorphs. It is a plain array
and a lot of things rely on this. You can implement a wrapper Morph with
all that logic, instead.

>
>
> Another approach would be a selector in the TableLayoutProperties
> to have all submorphs skipped that are hidden via classical #visible.
> But this would be less powerful as you couldn't combine both kinds of
> hiding in the same morph. But maybe this would be even better in terms
> of avoiding complexity?

Not a good idea IMO to use a property tag to represent another property.
#visible should just be about visibility.

Best,

Stef

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200403/4e1d163f/attachment-0001.html>


More information about the Squeak-dev mailing list