mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 22:49:30 +02:00
IDE: improve column widths in component palette options ListView. Patch from Sandro Cumerlato.
git-svn-id: trunk@47275 -
This commit is contained in:
parent
c7510d07b7
commit
f705a02f69
@ -216,17 +216,17 @@ object CompPaletteOptionsFrame: TCompPaletteOptionsFrame
|
||||
end
|
||||
item
|
||||
Caption = 'Name'
|
||||
MaxWidth = 300
|
||||
MinWidth = 50
|
||||
Width = 145
|
||||
end
|
||||
item
|
||||
Caption = 'Page'
|
||||
MaxWidth = 1000
|
||||
MinWidth = 50
|
||||
Width = 201
|
||||
end
|
||||
item
|
||||
Caption = 'Package'
|
||||
Caption = 'Unit'
|
||||
MinWidth = 50
|
||||
Width = 301
|
||||
end>
|
||||
DragMode = dmAutomatic
|
||||
|
@ -313,9 +313,15 @@ var
|
||||
PageCnt, CompCnt: Integer;
|
||||
StartInd, EndInd: Integer;
|
||||
RealPageName, CompName: String;
|
||||
bListAll : Boolean;
|
||||
TempWidth, NameWidth, PageWidth, UnitWidth : Integer;
|
||||
begin
|
||||
if aPageName = lis_All_ then
|
||||
bListAll := aPageName = lis_All_;
|
||||
if bListAll then
|
||||
begin
|
||||
NameWidth := 50;
|
||||
PageWidth := 50;
|
||||
UnitWidth := 50;
|
||||
StartInd := 1; // Skip the first entry for all components.
|
||||
EndInd := PagesListBox.Count-1;
|
||||
end
|
||||
@ -338,8 +344,28 @@ begin
|
||||
Item.SubItems.Add(RealPageName);
|
||||
Item.SubItems.Add(Comp.GetUnitName);
|
||||
Item.Data := Comp;
|
||||
if bListAll then
|
||||
begin
|
||||
TempWidth := 20 + ComponentsListView.Canvas.GetTextWidth(CompName);
|
||||
if TempWidth > NameWidth then NameWidth := TempWidth;
|
||||
TempWidth := 20 + ComponentsListView.Canvas.GetTextWidth(RealPageName);
|
||||
if TempWidth > PageWidth then PageWidth := TempWidth;
|
||||
TempWidth := 20 + ComponentsListView.Canvas.GetTextWidth(Comp.GetUnitName);
|
||||
if TempWidth > UnitWidth then UnitWidth := TempWidth;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if bListAll then
|
||||
begin
|
||||
// Setting Width:=0 is needed at least on Windows. TListView refuses to set
|
||||
// a column width which was set previously, even if user has adjusted it since.
|
||||
ComponentsListView.Column[1].Width := 0;
|
||||
ComponentsListView.Column[1].Width := NameWidth;
|
||||
ComponentsListView.Column[2].Width := 0;
|
||||
ComponentsListView.Column[2].Width := PageWidth;
|
||||
ComponentsListView.Column[3].Width := 0;
|
||||
ComponentsListView.Column[3].Width := UnitWidth;
|
||||
end;
|
||||
ComponentsListView.Items.EndUpdate;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user