View Issue Details

IDProjectCategoryView StatusLast Update
0014362LazarusLCLpublic2009-08-30 20:38
ReporterMartin Friebe Assigned ToPaul Ishenin  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version0.9.27 (SVN) 
Target Version1.0.0Fixed in Version0.9.29 (SVN) 
Summary0014362: label word wrap fails sometimes
DescriptionSee attached project.

It has 2 labels, that are identical, except for
- length and content of text
- font color (for distinction)

- They are both anchored on left, right and top to the form (could be other controls)
- Consequently they overlap
- they are bot autosize, and both word-wrap

They are free to resize on the bottom

The black one does not word wrap, but it should.
( and the other label wraps only once, even if more than 2 lines would be needed)
Additional InformationIn real case they would be invisible, and only one would be shown at a time, but even with only one visible, one will, the other will not word wrap. this can be seen on the new mouse options page
TagsNo tags attached.
Fixed in Revision21486
Attached Files


related to 0014474 closedPaul Ishenin regression: file->new crashes under gtk2 


2009-08-16 14:59


bug_word_wrap.rar (3,220 bytes)

Martin Friebe

2009-08-16 15:59

manager   ~0029909

Interesting: on the edit-options-mouse, I was able to fix it, by temporarily anchoring both labels (bottom anchor) to the bottom of the frame (explicitly selected as control, not nil) and then undoing it.
The result: anchorside is still set, but the anchor not enabled.

Yet I was unable to reproduce this part on the attached project.

José Mejuto

2009-08-18 19:32

reporter   ~0029961

The bug appears as, if WordWrap is enabled, autosize should work in vertical axis instead horizontal ones. The attached patch solves the problem at least in Win32 and GTK2 (Win and Ubuntu).
The CalculatePreferredSize is not 100% compatible with Delphi7 as there is no way to create an autosize vertical label of 1 pixel width, but LCL behaviour seems to be more logical using the largest word as the minimun width.

2009-08-18 19:33


custom_label_wordwrap_autosize.patch (693 bytes)   
---	(revision 21261)
+++	(working copy)
@@ -96,7 +96,13 @@
   if AutoSizeDelayed then
-  GetPreferredSize(NewWidth, NewHeight);
+  if WordWrap Then begin
+    NewWidth:=Width;
+    CalculatePreferredSize(NewWidth,NewHeight,false);
+  end else begin
+    GetPreferredSize(NewWidth, NewHeight);
+  end;
   //debugln('TCustomLabel.DoAutoSize ',dbgsName(Self),' Nice ',dbgs(Left),',',dbgs(Top),',w=',dbgs(NewWidth),',h=',dbgs(NewHeight),' Caption="',dbgstr(Caption),'"');
   if Align in [alLeft,alRight,alBottom,alTop,alClient] then

Paul Ishenin

2009-08-30 19:24

manager   ~0030246

Patch is not correct. I implemented this another way. Please test and close if ok.

Martin Friebe

2009-08-30 20:38

manager   ~0030249

works like a charm, thanks

Issue History

Date Modified Username Field Change
2009-08-16 14:59 Martin Friebe New Issue
2009-08-16 14:59 Martin Friebe File Added: bug_word_wrap.rar
2009-08-16 14:59 Martin Friebe LazTarget => -
2009-08-16 14:59 Martin Friebe Widgetset => Win32/Win64
2009-08-16 15:01 Martin Friebe Description Updated
2009-08-16 15:59 Martin Friebe Note Added: 0029909
2009-08-17 16:46 Vincent Snijders LazTarget - => 1.0
2009-08-17 16:46 Vincent Snijders Status new => acknowledged
2009-08-17 16:46 Vincent Snijders Target Version => 1.0.0
2009-08-18 19:32 José Mejuto Note Added: 0029961
2009-08-18 19:33 José Mejuto File Added: custom_label_wordwrap_autosize.patch
2009-08-30 19:24 Paul Ishenin Fixed in Revision => 21486
2009-08-30 19:24 Paul Ishenin Status acknowledged => resolved
2009-08-30 19:24 Paul Ishenin Fixed in Version => 0.9.29 (SVN)
2009-08-30 19:24 Paul Ishenin Resolution open => fixed
2009-08-30 19:24 Paul Ishenin Assigned To => Paul Ishenin
2009-08-30 19:24 Paul Ishenin Note Added: 0030246
2009-08-30 20:38 Martin Friebe Status resolved => closed
2009-08-30 20:38 Martin Friebe Note Added: 0030249
2009-09-01 15:53 Vincent Snijders Relationship added related to 0014474