[Cuis-dev] LayoutMorph separation

Bernhard Pieber bernhard at pieber.com
Sun Aug 25 12:10:32 PDT 2024


Hi,

Sorry for the late reply. I just read this thread after a holiday away from the keyboard.

It's great that that functionality got integrated. I had the same need and proposed a change set in May, see the email thread "LayoutMorph separate padding and spacing" [1] and my answer in the thread "morphs padding and margin" [2].

However, instead of an additional boolean instance variable (useEdgeSpace) I chose to split separation into padding (inner distance to the borders) and spacing (distance between elements). I chose the name padding because that's how it's called in the CSS box model [3].

I did keep the instance variable separation in the first step, as it is currently used in UI-Panel and UI-Click-Select in Cuis-Smalltalk-UI. However, I prepared updates for those packages after which the instance variable separation should be deleted.

In a third step the instance variable padding could be moved to the superclass BoxedMorph and be supplemented by the property margin (outer distance to the borders), which is also part of the CSS box model [3] and widely used in web design.

I would ike this design because LayoutMorph would become simpler again, BoxedMorph would become more flexible and at the same time easier to understand for people with knowledge of CSS. What do you think?

Cheers,
Bernhard

[1] https://lists.cuis.st/mailman/archives/cuis-dev/2024-May/008772.html
[2] https://lists.cuis.st/mailman/archives/cuis-dev/2024-June/009021.html
[3] https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/The_box_model#margins_padding_and_borders

> Am 21.08.2024 um 18:03 schrieb Juan Vuletich via Cuis-dev <cuis-dev at lists.cuis.st>:
>
> Hi Folks,
>
> On 8/14/2024 5:59 PM, ken.dickey--- via Cuis-dev wrote:
>
>> On 2024-08-13 17:01, Mark Volkmann via Cuis-dev wrote:
>>
>>> On Tue, Aug 13, 2024 at 9:18 AM <ken.dickey at whidbey.com> wrote:
>>>
>>>> On 2024-08-12 17:01, Mark Volkmann via Cuis-dev wrote:
>>>>
>>>>> I seem to keep running into situations where I want separation in a
>>>>> LayoutMorph to only be added between the submorphs and not before the
>>>>> first and after the last. I see that I can achieve that by modifying
>>>>> the LayoutMorph method layoutSubmorphsHorizontallyIn:. But I don't
>>>>> always want that behavior. I'd like that to be configurable. Is there
>>>>> already a way to do this that I'm missing?
>>
>>> No.
>>
>>>>> I'd rather not have to insert spacer morphs, especially if there
>>>>> are a large number of submorphs.
>>>>> I attached my solution which is to create a subclass of LayoutMorph
>>>>> that adds a boolean instance variable "trim".
>>>>> When that is true, it avoids adding separation before the first and
>>>>> after the last submorph.
>>>>> This works for my use cases.
>>>>> It would be great if this was added to LayoutMorph. It wouldn't
>>>>> affect its current behavior.
>>
>> Mark, thanks much for contributing.
>>
>> Two things:
>> [A] I prefer #useEdgeSpace to #trim as 'trim' seems too generic a
>> term to me. ['shrinkWrap' might work as well].
>> [B] Due to edge cases, the math is a bit difficult to get right.
>>
>> Please check the code and try `Layout2Morph example1` in the attached.
>>
>> I am still testing, but think this may be close to what you want.
>>
>> Thanks again for this!
>> -KenD
>
> Thank you very much Mark and Ken for working on this!
>
> I've just integrated a slightly later version of this code with your
> latest work. It works nicely.
>
> Thanks!
>
> --
> Juan Vuletich
> cuis.st
> github.com/jvuletich
> researchgate.net/profile/Juan-Vuletich
> independent.academia.edu/JuanVuletich
> patents.justia.com/inventor/juan-manuel-vuletich
> linkedin.com/in/juan-vuletich-75611b3
> twitter.com/JuanVuletich
>
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240825/3a68d610/attachment.htm>


More information about the Cuis-dev mailing list