[Cuis-dev] LabelMorph text alignment
Alexandre Rousseau
yalexr at gmail.com
Tue Mar 14 08:19:21 PDT 2023
Thanks. I ended up subclassing LayoutMorph, invoking it like this:
m := LabelTextAlignmentMorph label: (LabelMorph contents: '0.0') align:
> #right.
[image: Screenshot 2023-03-14 at 11.06.49 AM.png]
On Tue, Mar 14, 2023 at 10:22 AM <ken.dickey at whidbey.com> wrote:
> On 2023-03-14 06:06, Alexandre Rousseau via Cuis-dev wrote:
>
> > Hi all.
> >
> > Given this code ...
> >
> >> "self is a LayoutMorph newColumn instance"
> >
> >> m := LabelMorph new :: contents: '0.0'.
> >
> >> m borderWidth: 3; borderColor: Color black.
> >> m layoutSpec :: proportionalWidth: 1.0.
> >> self addMorph: m.
> >
> > I would like the text inside m to be right-aligned.
> >
> > Am I correct in assuming that there is no other way to achieve this
> > (text-alignment right) than to embed another LayoutMorph newRow
> > instance inside of self, and then embed m (the LabelMorph instance)
> > inside of that?
>
> Probably most simple way is to subclass LabelMorph to do what you want.
>
> Feature require: 'UI-Base-Morphs'
>
> Then look at class #SqueezeLabelMorph
>
> THe code should give enought hints on how to do what you want.
>
> More fun to do it yourself. :)
>
> HTH,
> -KenD
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230314/80c81bc4/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot 2023-03-14 at 11.06.49 AM.png
Type: image/png
Size: 11222 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230314/80c81bc4/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LabelTextAlignmentMorph.st
Type: application/octet-stream
Size: 1753 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230314/80c81bc4/attachment.obj>
More information about the Cuis-dev
mailing list