@@ -55,6 +55,7 @@ TFindCompilerDlg = class(TGenericOKDlg, INoPublicConstruct)
55
55
fSearchParams: TCompilerSearchParams; // Persistent compiler search options
56
56
fSearch: ISearch; // Search entered by user
57
57
fRefinePreviousSearch: Boolean; // Whether to refine previous search
58
+ fMapIdxToComp: TArray<TCompilerID>; // Maps list idx to comp ID of entry
58
59
59
60
procedure UpdateOKBtn ;
60
61
{ Updates state of OK button according to whether valid entries made in
@@ -363,13 +364,25 @@ procedure TFindCompilerDlg.InitForm;
363
364
Option: TCompilerSearchOption; // loops thru possible compiler search options
364
365
SelOption: Integer; // selected search option
365
366
Compiler: ICompiler; // references each compiler
367
+ CompID: TCompilerID;
366
368
begin
367
369
inherited ;
370
+ // Set up index map that reverses order of compilers
371
+ SetLength(fMapIdxToComp, fCompilers.Count);
372
+ Idx := High(fMapIdxToComp);
373
+ for CompID := Low(TCompilerID) to High(TCompilerID) do
374
+ begin
375
+ fMapIdxToComp[Idx] := CompID;
376
+ Dec(Idx);
377
+ end ;
378
+
368
379
// Set up list of compilers and check appropriate ones
369
380
// we store compiler ID in listbox's Objects[] property
370
- for Compiler in fCompilers do
381
+ // Use mapping to reverse order of compilers in list
382
+ for Idx := Low(fMapIdxToComp) to High(fMapIdxToComp) do
371
383
begin
372
- Idx := lbCompilerVers.Items.AddObject(
384
+ Compiler := fCompilers[fMapIdxToComp[Idx]];
385
+ lbCompilerVers.Items.AddObject(
373
386
Compiler.GetName, TObject(Compiler.GetID)
374
387
);
375
388
lbCompilerVers.Checked[Idx] := Compiler.GetID in fSearchParams.Compilers;
0 commit comments