[Cuis-dev] PlacedMorph vs BoxedMorph
Juan Vuletich
juan at cuis.st
Wed Sep 4 05:19:50 PDT 2024
Hi Bernhard,
On 9/2/2024 5:01 PM, Bernhard Pieber via Cuis-dev wrote:
> Hi Juan, Hilaire,
>
> I think the root cause of this problem is that these concepts are
> orthogonal. Maybe you want a morph that can be placed but has no
> border or the other way around. Single inheritance is just not good at
> expressing this. (This would be an ideal use case for stateful traits
> IMO.) However, why not use composition instead of inheritance? Instead
> of being a BoxedMorph any morph could just have a box (with border,
> padding) if it needed one. There might be other useful types of
> decorations for morphs, e.g. labels or scrolling. (Being a subclass of
> PluggableMorph every PluggableScrollPane has a model although it does
> not have a use for it.)
>
> Just my two cents…
>
> Cheers,
> Bernhard
What you suggest will have its own set of advantages and challenges.
Fortunately, in Cuis, Morph class is pretty minimal, only stating that
Morphs are nested in the owner / submorphs tree. Anything else is
handled by subclasses. PlacedMorph only adds location and optional
LayoutSpec.
So, here is my suggestion: Try it. Write new morphs, starting with one
(or several!) subclass(es) of Morph. Implement your decoration strategy.
You don't need to build any of the MorphicCanvas and MorphicEngine
stuff. Those are pretty general. Your new Morphs could most likely live
in the existing World. If not, you can write a new World. Switching
between your NewWorld and the existing World is simply suspending /
terminating the process for one UI and resuming / creating the process
for the other. (You can easily have several instances of WorldMorph
today if you want).
See where it leads. I'm sure it would be a wonderful learning experience
for all of us!
Cheers,
--
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240904/4104bb25/attachment.htm>
More information about the Cuis-dev
mailing list