[squeak-dev] rightFlush in TextMorph

Marcel Taeumel marcel.taeumel at hpi.de
Tue Mar 22 14:19:08 UTC 2022


Hi, there.

Replace "pluggableInputFieldSpec" with "pluggableTextSpec" and it will work.

There is currently no support for one-line text fields without line breaks growing from right-to-left, only from left-to-right. I think one could build this ... then again, once the content is larger than the view, one would not see left-flush or right-flush anyway. Hmm....

You can also reconfigure the input field to support soft line breaks:

builder:=MorphicToolBuilder new.
model:=ValueHolder new contents: 'sample text'.
spec:=builder pluggableInputFieldSpec new
getText: #contents; setText: #contents:; model: model;
textStyle: TextStyle default copy rightFlush;
softLineWrap: true.
widget:=builder build: spec.
"widget textMorph rightFlush. -- not needed, see above"
widget openInWorld.

Best,
Marcel
Am 22.03.2022 14:59:05 schrieb Marcel Taeumel <marcel.taeumel at hpi.de>:
Hi, there.

Let me check. Both rightFlush and centered work when changed via the menu.

Best,
Marcel
Am 22.03.2022 14:18:38 schrieb Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>:
Indeed, the paddingWidth (which is the available space remaining on the TextLine) appears to be zero, so both centered and rightFlush won't work.
Normally, the CompositionScanner is setting the paddingWidth for each line at composition time (on various stopConditions endOfRun, cr, etc...).
Apparently, this does not happen here, because there seems to be no composition...


Le mar. 22 mars 2022 à 09:36, Vaidotas Didžbalis <vaidasd at gmail.com [mailto:vaidasd at gmail.com]> a écrit :

Hello,
Executing lines below produces right aligned text field in Squeak 4.5, but does not Squeak v4.6 or any later version, I wander is this a bug? Anyone using right aligned input fields in Squeak?
regards, Vaidotas 

builder:=MorphicToolBuilder new.
model:=ValueHolder new contents: 'sample text'.
spec:=builder pluggableInputFieldSpec new getText: #contents; setText: #contents:;  model: model.
widget:=builder build: spec.
widget textMorph rightFlush.
widget openInWorld.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220322/1dcbe784/attachment.html>


More information about the Squeak-dev mailing list