![]() | Steema Issues DatabaseNote: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;otherwise you can use StackOverflow. Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy. |
| Summary: | Auto width calculation does not work correctly if expander is shown | ||
|---|---|---|---|
| Product: | TeeGrid for Delphi | Reporter: | dean.mustakinov |
| Component: | Grid | Assignee: | david berneda <david> |
| Status: | RESOLVED FIXED | ||
| Severity: | enhancement | CC: | marc |
| Priority: | --- | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| Chart Series: | --- | Delphi / C++ Builder RAD IDE Version: | |
When expander is shown in a column the automatic width calculation does not take it into account. I have made a small change to fix this (my changes are marked with // DM CHANGE comments). Tee.Grid.RowGroup.pas: function TRowGroup.CalcAutoWidth(const APainter:TPainter; const AColumn:TColumn; const AWidth:Single):Single; function CustomColumnMargins:TMargins; begin if AColumn.HasRender then result:=AColumn.Margins else if TTextRenderAccess(Cells).HasMargins then result:=Cells.Margins else result:=nil; end; function HeaderWidth:Single; begin if Header.Visible then result:=Header.AutoWidth(APainter,AColumn) else result:=0; end; var tmp : Single; rw : Single; // DM CHANGE tmpMargins : TMargins; begin result:=HeaderWidth; if AColumn.HasItems then tmp:=WidthOf(APainter,AColumn.Items,AWidth) else if Data=nil then tmp:=0 else begin APainter.SetFont(Rows.FontOf(AColumn)); // DM CHANGE START if (AColumn.Render <> nil) and (AColumn.Render is TBoxRender) then rw := TBoxRender(AColumn.Render).Box.Size * 3 // roughly else rw := 0; // DM CHANGE END tmp:=TColumnAccess(AColumn).AutoWidth(APainter); if tmp=0 then begin tmp:=Data.AutoWidth(APainter,AColumn) + rw; // DM CHANGE tmpMargins:=CustomColumnMargins; if tmpMargins<>nil then begin tmpMargins.Prepare(tmp,0); tmp:=tmp+tmpMargins.Horizontal; end; end else tmp := tmp + rw; // DM CHANGE if tmp<MinColumnWidth then tmp:=MinColumnWidth; end; if tmp>result then result:=tmp; end;