[Lazarus] RE : RE : Right-aligned word wrap label doesn't seem to work

Ludo Brands ludo.brands at free.fr
Sun Nov 27 13:52:27 CET 2011


> The LCL extends the Width if possible.
> A fixed Width can be set with Constraints.Min/MaxWidth or 
> using Anchors. The label will extend the Height if WordWrap 
> is true and the Width is fixed.
> 

Mmm... Seems there are some problems with the windows implementation. On
windows set maxwidth:=45 autosize:=true wordwrap:=true and enter in caption
'line1 line2 line3 line4 line5 line666666666666666666666'. Until line6 all
is ok but as you enter more 6'es the hight is shrinking and lines drop.
Do the same with Alignment:=taRightJustify and you'll notice that when
typing line2, the 2nd line disappears (Reiniers problem) but as soon you
enter another character the 2nd line appears again. When finished typing
line3, the line interspacing suddenly doubles. Probably the line
interspacing is the reason why line 2 disappeared. Possibly your default
font is different than mine and the "behavior" is triggered at other
moments.
  

> That means the LCL does not need any special rule for TLabel.
> 
> This has also the advantage that a LCL wordwrapped TLabel can 
> resize in both directions.
> 

Top or bottom anchor centered to sibling you mean?

> So, the LCL is more consistent and more powerful. So I would 
> prefer to break Delphi compatibility here.
> 

Somewhat more work is needed for the frequently used right aligned, fixed
right side, left anchored labels. You need to right anchor the label to a
left anchored sibling.  

Ludo





More information about the Lazarus mailing list