diff --git a/ide/frames/componentpalette_options.lfm b/ide/frames/componentpalette_options.lfm index 2eeebf9c57..9eab607db0 100644 --- a/ide/frames/componentpalette_options.lfm +++ b/ide/frames/componentpalette_options.lfm @@ -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 diff --git a/ide/frames/componentpalette_options.pas b/ide/frames/componentpalette_options.pas index 1d16770a0d..9233bfe958 100644 --- a/ide/frames/componentpalette_options.pas +++ b/ide/frames/componentpalette_options.pas @@ -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;