mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 10:49:09 +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
|
end
|
||||||
item
|
item
|
||||||
Caption = 'Name'
|
Caption = 'Name'
|
||||||
MaxWidth = 300
|
|
||||||
MinWidth = 50
|
MinWidth = 50
|
||||||
Width = 145
|
Width = 145
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
Caption = 'Page'
|
Caption = 'Page'
|
||||||
MaxWidth = 1000
|
MinWidth = 50
|
||||||
Width = 201
|
Width = 201
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
Caption = 'Package'
|
Caption = 'Unit'
|
||||||
|
MinWidth = 50
|
||||||
Width = 301
|
Width = 301
|
||||||
end>
|
end>
|
||||||
DragMode = dmAutomatic
|
DragMode = dmAutomatic
|
||||||
|
@ -313,9 +313,15 @@ var
|
|||||||
PageCnt, CompCnt: Integer;
|
PageCnt, CompCnt: Integer;
|
||||||
StartInd, EndInd: Integer;
|
StartInd, EndInd: Integer;
|
||||||
RealPageName, CompName: String;
|
RealPageName, CompName: String;
|
||||||
|
bListAll : Boolean;
|
||||||
|
TempWidth, NameWidth, PageWidth, UnitWidth : Integer;
|
||||||
begin
|
begin
|
||||||
if aPageName = lis_All_ then
|
bListAll := aPageName = lis_All_;
|
||||||
|
if bListAll then
|
||||||
begin
|
begin
|
||||||
|
NameWidth := 50;
|
||||||
|
PageWidth := 50;
|
||||||
|
UnitWidth := 50;
|
||||||
StartInd := 1; // Skip the first entry for all components.
|
StartInd := 1; // Skip the first entry for all components.
|
||||||
EndInd := PagesListBox.Count-1;
|
EndInd := PagesListBox.Count-1;
|
||||||
end
|
end
|
||||||
@ -338,8 +344,28 @@ begin
|
|||||||
Item.SubItems.Add(RealPageName);
|
Item.SubItems.Add(RealPageName);
|
||||||
Item.SubItems.Add(Comp.GetUnitName);
|
Item.SubItems.Add(Comp.GetUnitName);
|
||||||
Item.Data := Comp;
|
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;
|
||||||
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;
|
ComponentsListView.Items.EndUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user