View Issue Details

IDProjectCategoryView StatusLast Update
0001209Double CommanderGraphical user interfacepublic2020-06-19 21:51
Reporternicker Assigned ToAlexx2000  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
ProjectionnoneETAnone 
Platformx64OSWindowsOS Version10
Product Version0.7.0 (trunk)Product Buildrevision 6381 
Target Version0.7.0Fixed in Version0.7.0 
Summary0001209: Choosing a drive using the keyboard doesn't work if the active language is not English or CAPS LOCK is off
DescriptionI added a patch that fixes this issue.
Steps To Reproduce1. Activate Caps lock and/or change the keyboard language to other than English.
2. Press Alt+F1.
3. Choose any drive other than the active by pressing the corresponding key letter.
TagsNo tags attached.
Attached Files
udriveslist.pas.patch (1,846 bytes)   
Index: udriveslist.pas
===================================================================
--- udriveslist.pas	(revision 6381)
+++ udriveslist.pas	(working copy)
@@ -61,8 +61,6 @@
     procedure EnterEvent(Sender: TObject);
     procedure ExitEvent(Sender: TObject);
     procedure KeyDownEvent(Sender: TObject; var Key: Word; Shift: TShiftState);
-    procedure KeyPressEvent(Sender: TObject; var Key: Char);
-    procedure UTF8KeyPressEvent(Sender: TObject; var UTF8Key: TUTF8Char);
 
     procedure SelectDrive(ADriveIndex: Integer);
     procedure DoDriveSelected(ADriveIndex: Integer);
@@ -174,8 +172,6 @@
   OnEnter         := @EnterEvent;
   OnExit          := @ExitEvent;
   OnKeyDown       := @KeyDownEvent;
-  OnKeyPress      := @KeyPressEvent;
-  OnUTF8KeyPress  := @UTF8KeyPressEvent;
 end;
 
 procedure TDrivesListPopup.UpdateDrivesList(ADrivesList: TDrivesList);
@@ -461,21 +457,12 @@
         ShowContextMenu(GetDriveIndexByRow(Row), Rect.Left, Rect.Top);
         Key := 0;
       end;
-  end;
+    else
+    if (CheckShortcut(TUTF8Char(Char(Key)))) then
+      Key:=0;
+    end;
 end;
 
-procedure TDrivesListPopup.KeyPressEvent(Sender: TObject; var Key: Char);
-begin
-  if CheckShortcut(TUTF8Char(Key)) then
-    Key := #0;
-end;
-
-procedure TDrivesListPopup.UTF8KeyPressEvent(Sender: TObject; var UTF8Key: TUTF8Char);
-begin
-  if CheckShortcut(UTF8Key) then
-    UTF8Key := '';
-end;
-
 procedure TDrivesListPopup.SelectDrive(ADriveIndex: Integer);
 begin
   if (ADriveIndex >= 0) and (ADriveIndex < DrivesCount) then
@@ -551,7 +538,7 @@
       if Length(Drive^.DisplayName) > 0 then
       begin
         Cells[1, RowNr] := Drive^.DisplayName;
-        FShortCuts[I] := UTF8Copy(Drive^.DisplayName, 1, 1);
+        FShortCuts[I] := UTF8Copy(UpperCase(Drive^.DisplayName), 1, 1);
       end
       else
       begin
udriveslist.pas.patch (1,846 bytes)   
udriveslist-2015-11-19.pas.patch (2,123 bytes)   
Index: udriveslist.pas
===================================================================
--- udriveslist.pas	(revision 6386)
+++ udriveslist.pas	(working copy)
@@ -24,6 +24,10 @@
 
 {$mode objfpc}{$H+}
 
+{$IFDEF MSWINDOWS}
+    {$DEFINE ForceVirtualKeysShortcuts}
+{$ENDIF}
+
 interface
 
 uses
@@ -61,9 +65,10 @@
     procedure EnterEvent(Sender: TObject);
     procedure ExitEvent(Sender: TObject);
     procedure KeyDownEvent(Sender: TObject; var Key: Word; Shift: TShiftState);
+{$IFNDEF ForceVirtualKeysShortcuts}
     procedure KeyPressEvent(Sender: TObject; var Key: Char);
     procedure UTF8KeyPressEvent(Sender: TObject; var UTF8Key: TUTF8Char);
-
+{$ENDIF}
     procedure SelectDrive(ADriveIndex: Integer);
     procedure DoDriveSelected(ADriveIndex: Integer);
     procedure ShowContextMenu(ADriveIndex: Integer; X, Y: Integer);
@@ -174,8 +179,10 @@
   OnEnter         := @EnterEvent;
   OnExit          := @ExitEvent;
   OnKeyDown       := @KeyDownEvent;
+{$IFNDEF ForceVirtualKeysShortcuts}
   OnKeyPress      := @KeyPressEvent;
   OnUTF8KeyPress  := @UTF8KeyPressEvent;
+{$ENDIF}
 end;
 
 procedure TDrivesListPopup.UpdateDrivesList(ADrivesList: TDrivesList);
@@ -461,9 +468,14 @@
         ShowContextMenu(GetDriveIndexByRow(Row), Rect.Left, Rect.Top);
         Key := 0;
       end;
+{$IFDEF ForceVirtualKeysShortcuts}
+    else if (CheckShortcut(TUTF8Char(Char(Key)))) then
+      Key := 0;
+{$ENDIF}
   end;
 end;
 
+{$IFNDEF ForceVirtualKeysShortcuts}
 procedure TDrivesListPopup.KeyPressEvent(Sender: TObject; var Key: Char);
 begin
   if CheckShortcut(TUTF8Char(Key)) then
@@ -475,6 +487,7 @@
   if CheckShortcut(UTF8Key) then
     UTF8Key := '';
 end;
+{$ENDIF}
 
 procedure TDrivesListPopup.SelectDrive(ADriveIndex: Integer);
 begin
@@ -551,7 +564,11 @@
       if Length(Drive^.DisplayName) > 0 then
       begin
         Cells[1, RowNr] := Drive^.DisplayName;
+{$IFDEF ForceVirtualKeysShortcuts}
+        FShortCuts[I] := UTF8Copy(UpperCase(Drive^.DisplayName), 1, 1);
+{$ELSE}
         FShortCuts[I] := UTF8Copy(Drive^.DisplayName, 1, 1);
+{$ENDIF}
       end
       else
       begin
Fixed in Revision6394
Operating systemWindows
Widgetset
Architecture64-bit

Relationships

has duplicate 0001246 closed Меню выбора диска (Alt+F1/F2) чувствительно к текущему языку 

Activities

Alexx2000

2015-11-13 08:51

administrator   ~0001595

Patch is not correct, because under non-Windows OS "drive" name can begin with non latin characters. That's why OnKeyPress and OnUTF8KeyPress used.

nicker

2015-11-13 14:00

reporter   ~0001596

Indeed, it's documented in the Linux man pages.

I can upload a new patch or you can take it from here.

nicker

2015-11-19 15:46

reporter   ~0001598

I've uploaded a better patch "udriveslist-2015-11-19.pas.patch"

Issue History

Date Modified Username Field Change
2015-11-13 01:05 nicker New Issue
2015-11-13 01:06 nicker File Added: udriveslist.pas.patch
2015-11-13 08:51 Alexx2000 Note Added: 0001595
2015-11-13 08:51 Alexx2000 Status new => feedback
2015-11-13 14:00 nicker Note Added: 0001596
2015-11-13 14:00 nicker Status feedback => new
2015-11-19 02:14 nicker File Added: udriveslist-2015-11-19.pas.patch
2015-11-19 15:46 nicker Note Added: 0001598
2015-11-22 17:53 Alexx2000 Fixed in Revision => 6394
2015-11-22 17:53 Alexx2000 Status new => resolved
2015-11-22 17:53 Alexx2000 Resolution open => fixed
2015-11-22 17:53 Alexx2000 Assigned To => Alexx2000
2015-11-22 17:53 Alexx2000 Fixed in Version => 0.7.0
2015-11-22 17:53 Alexx2000 Target Version => 0.7.0
2015-12-30 06:32 Alexx2000 Relationship added has duplicate 0001246
2020-06-19 21:51 Alexx2000 Status resolved => closed