View Issue Details

IDProjectCategoryView StatusLast Update
0032621LazarusLCLpublic2018-09-17 21:02
ReporterMike Sapsard Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformLinux x64_64OSLinux Mint 
Product Version1.8RC5 
Summary0032621: Groupbox caption is truncated
DescriptionWith autosize true, a groupbox caption display and groupbox width is limited to just include the longest child caption.
Steps To ReproduceCreate a groupbox. Give it a long caption. Add a radio button with a short caption. Size the groupbox to be just wide enough. Display form. Increase the groupbox caption length. Display form.
TagsNo tags attached.
Fixed in Revisionr59016, r59046
LazTarget-
WidgetsetGTK 2
Attached Files

Relationships

related to 0034294 closedJuha Manninen Gtk2: TGroupBox - bad child sizing 

Activities

accorp

2018-09-15 20:53

reporter  

issue-32621.diff (500 bytes)   
Index: lcl/interfaces/gtk2/gtk2proc.inc
===================================================================
--- lcl/interfaces/gtk2/gtk2proc.inc	(revision 59003)
+++ lcl/interfaces/gtk2/gtk2proc.inc	(working copy)
@@ -6547,6 +6547,7 @@
   {$ENDIF}
 
   if GtkWidgetIsA(Widget,GTK_TYPE_EVENT_BOX)
+  and not (AWinControl is TCustomGroupBox) // Issue 32621
   and (AWinControl.ControlCount>0) then begin
     // ignore client area (child controls)
     FixedWidget:=PGtkWidget(GetFixedWidget(Widget));
issue-32621.diff (500 bytes)   

accorp

2018-09-15 20:55

reporter   ~0110773

This is a regression caused by r47869. Uploaded a patch.

Juha Manninen

2018-09-15 23:41

developer   ~0110776

Last edited: 2018-09-15 23:46

View 2 revisions

> This is a regression caused by r47869.

Wow, you did some serious bisecting! The commit is from February 2015.
 "LCL: gtk2: GetPreferredSize: subtract client area" by Mattias.
I applied the patch. Thanks.
This will be the first commit explicitly merged to a brand new 2.0 branch.

accorp, are you in the contributors list? What is your real name?

accorp

2018-09-16 18:08

reporter  

issue-32621-fix.diff (1,245 bytes)   
Index: lcl/interfaces/gtk2/gtk2proc.inc
===================================================================
--- lcl/interfaces/gtk2/gtk2proc.inc	(revision 59032)
+++ lcl/interfaces/gtk2/gtk2proc.inc	(working copy)
@@ -6523,7 +6523,7 @@
 var
   Widget: PGtkWidget;
   Requisition: TGtkRequisition;
-  FixedWidget: PGtkWidget;
+  FixedWidget, LblWidget: PGtkWidget;
 begin
   Widget := {%H-}PGtkWidget(AWinControl.Handle);
   {$IFDEF VerboseCalculatePreferredSize}
@@ -6547,7 +6547,6 @@
   {$ENDIF}
 
   if GtkWidgetIsA(Widget,GTK_TYPE_EVENT_BOX)
-  and not (AWinControl is TCustomGroupBox)
   and (AWinControl.ControlCount>0) then begin
     // ignore client area (child controls)
     FixedWidget:=PGtkWidget(GetFixedWidget(Widget));
@@ -6563,6 +6562,13 @@
     end;
   end;
 
+  // Do not truncate Groupbox caption. Issue #32621
+  if AWinControl is TCustomGroupBox then begin
+    LblWidget := gtk_frame_get_label_widget(PGtkFrame(PGtkBin(Widget)^.child));
+    if LblWidget <> nil then
+      PreferredWidth := Max(PreferredWidth, LblWidget^.allocation.x * 2 + LblWidget^.requisition.width);
+  end;
+
   // restore size
   gtk_widget_set_size_request(Widget, AWinControl.Width, AWinControl.Height);
   {$IFDEF VerboseCalculatePreferredSize}
issue-32621-fix.diff (1,245 bytes)   

accorp

2018-09-16 18:10

reporter   ~0110805

I was going to write "hope the patch will not cause another regression" but it does: autosized GroupBox does not shrink sometimes. (I made a wrong assumption what the comment "ignore client area (child controls)" means).
Attached patch revert previous change and adds proper fix.

Juha Manninen

2018-09-17 21:02

developer   ~0110832

I applied the new patch. Thanks.

Issue History

Date Modified Username Field Change
2017-10-27 18:58 Mike Sapsard New Issue
2018-09-15 20:53 accorp File Added: issue-32621.diff
2018-09-15 20:55 accorp Note Added: 0110773
2018-09-15 23:36 Juha Manninen Assigned To => Juha Manninen
2018-09-15 23:36 Juha Manninen Status new => assigned
2018-09-15 23:41 Juha Manninen Fixed in Revision => r59016
2018-09-15 23:41 Juha Manninen LazTarget => -
2018-09-15 23:41 Juha Manninen Note Added: 0110776
2018-09-15 23:41 Juha Manninen Status assigned => resolved
2018-09-15 23:41 Juha Manninen Resolution open => fixed
2018-09-15 23:46 Juha Manninen Note Edited: 0110776 View Revisions
2018-09-16 18:08 accorp File Added: issue-32621-fix.diff
2018-09-16 18:10 accorp Note Added: 0110805
2018-09-17 20:49 Juha Manninen Relationship added related to 0034294
2018-09-17 20:52 Juha Manninen Status resolved => assigned
2018-09-17 20:52 Juha Manninen Resolution fixed => reopened
2018-09-17 21:02 Juha Manninen Fixed in Revision r59016 => r59016, r59046
2018-09-17 21:02 Juha Manninen Note Added: 0110832
2018-09-17 21:02 Juha Manninen Status assigned => resolved
2018-09-17 21:02 Juha Manninen Resolution reopened => fixed