Hi!

I find it disturbing that in the "installed Packages" Window the Lists are not sorted alphabetically and that the "available Packages" List jumps to the first entry after each entry.

So I wrote a fix for that - attached a diff against svn 16958.

As I'm not shure if the original, unsorted window was made on purpose I suggest this change here and rfc.

regards
Lukas

--

----------------------------
software security networks
Lukas Gradl <lazarus#ssn.at>
Eduard-Bodem-Gasse 9
A - 6020 Innsbruck
Tel: +43-512-214040-0
Fax: +43-512-214040-21
----------------------------
Index: packager/installpkgsetdlg.pas
===================================================================
--- packager/installpkgsetdlg.pas	(Revision 16958)
+++ packager/installpkgsetdlg.pas	(Arbeitskopie)
@@ -327,6 +327,7 @@
     end;
     ANode:=fPackages.FindSuccessor(ANode);
   end;
+  sl.Sort;
   AvailableListBox.Items.Assign(sl);
   sl.Free;
 end;
@@ -336,19 +337,17 @@
   s: String;
   NewPackageID: TLazPackageID;
   i: Integer;
+  sl: TStringList;
 begin
-  InstallListBox.Items.BeginUpdate;
+  sl:=TStringList.Create;
   for i:=0 to FNewInstalledPackages.Count-1 do begin
     NewPackageID:=TLazPackageID(FNewInstalledPackages[i]);
     s:=NewPackageID.IDAsString;
-    if InstallListBox.Items.Count>i then
-      InstallListBox.Items[i]:=s
-    else
-      InstallListBox.Items.Add(s);
+    sl.Add(s);
   end;
-  while InstallListBox.Items.Count>FNewInstalledPackages.Count do
-    InstallListBox.Items.Delete(InstallListBox.Items.Count-1);
-  InstallListBox.Items.EndUpdate;
+  sl.Sort;
+  InstallListBox.Items.Assign(sl);  
+  sl.Free;
 end;
 
 procedure TInstallPkgSetDialog.OnIteratePackages(APackageID: TLazPackageID);
@@ -652,7 +651,6 @@
       Additions.Add(NewPackageID);
       NewPackageID:=TLazPackageID.Create;
     end;
-    AvailableListBox.ItemIndex:=-1;
     // all ok => add to list
     for i:=0 to Additions.Count-1 do
       FNewInstalledPackages.Add(Additions[i]);
_______________________________________________
Lazarus mailing list
Lazarus@lazarus.freepascal.org
http://www.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to