DEADSOFTWARE

file listboxes now have advanced hotkey technology
authorfgsfds <pvt.fgsfds@gmail.com>
Fri, 12 Apr 2019 13:15:41 +0000 (16:15 +0300)
committerfgsfds <pvt.fgsfds@gmail.com>
Fri, 12 Apr 2019 13:15:41 +0000 (16:15 +0300)
src/game/g_gui.pas

index 9b44f6f8a7b8a4e572c1e4b31216598c57b4ec6d..42c2c6b66a08ab53ccfe6ac9a8187763004f78a7 100644 (file)
@@ -3145,7 +3145,7 @@ end;
 
 procedure TGUIFileListBox.OnMessage(var Msg: TMessage);
 var
-  a: Integer;
+  a, b: Integer;
 begin
   if not FEnabled then
     Exit;
@@ -3242,7 +3242,9 @@ begin
         end;
 
       WM_CHAR:
-        for a := 0 to High(FItems) do
+        for b := FIndex + 1 to High(FItems) + FIndex do
+        begin
+          a := b mod Length(FItems);
           if ( (Length(FItems[a]) > 0) and
                (LowerCase(FItems[a][1]) = LowerCase(Chr(wParam))) ) or
              ( (Length(FItems[a]) > 1) and
@@ -3255,6 +3257,7 @@ begin
               FOnChangeEvent(Self);
             Break;
           end;
+        end;
     end;
 end;