Forráskód Böngészése

Bug fix: Pressing Alt with combo box focused did not show keyboard accelerators

Related to 4031057b67

Source commit: b796982e9cbd43669629b7a1d9cd3b4c8fa3515f
Martin Prikryl 6 éve
szülő
commit
822683ed3c

+ 20 - 1
source/packages/my/HistoryComboBox.pas

@@ -6,6 +6,12 @@ uses
   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
   StdCtrls;
   StdCtrls;
 
 
+type
+  TUIStateAwareComboBox = class(TComboBox)
+  protected
+    procedure ComboWndProc(var Message: TMessage; ComboWnd: HWnd; ComboProc: TWindowProcPtr); override;
+  end;
+
 type
 type
   THistorySaveOn = set of (soExit, soDropDown);
   THistorySaveOn = set of (soExit, soDropDown);
 
 
@@ -19,7 +25,7 @@ type
   THistoryComboBoxGetData = procedure(Sender: THistoryComboBox; var Data: Pointer) of object;
   THistoryComboBoxGetData = procedure(Sender: THistoryComboBox; var Data: Pointer) of object;
   THistoryComboBoxSetData = procedure(Sender: THistoryComboBox; Data: Pointer) of object;
   THistoryComboBoxSetData = procedure(Sender: THistoryComboBox; Data: Pointer) of object;
 
 
-  THistoryComboBox = class(TComboBox)
+  THistoryComboBox = class(TUIStateAwareComboBox)
   private
   private
     { Private declarations }
     { Private declarations }
     FSaveOn: THistorySaveOn;
     FSaveOn: THistorySaveOn;
@@ -72,6 +78,19 @@ begin
     Strings.Delete(Strings.Count-1);
     Strings.Delete(Strings.Count-1);
 end;
 end;
 
 
+  { TUIStateAwareComboBox }
+
+procedure TUIStateAwareComboBox.ComboWndProc(var Message: TMessage; ComboWnd: HWnd; ComboProc: TWindowProcPtr);
+begin
+  inherited;
+
+  if Message.Msg = WM_SYSKEYDOWN then
+  begin
+    UpdateUIState(TWMKey(Message).CharCode);
+  end;
+end;
+
+
   { THistoryComboBox }
   { THistoryComboBox }
 
 
 constructor THistoryComboBox.Create(AOwner: TComponent);
 constructor THistoryComboBox.Create(AOwner: TComponent);

+ 5 - 0
source/windows/GUITools.cpp

@@ -25,6 +25,7 @@
 #include <VCLCommon.h>
 #include <VCLCommon.h>
 #include <WinApi.h>
 #include <WinApi.h>
 #include <Vcl.ScreenTips.hpp>
 #include <Vcl.ScreenTips.hpp>
+#include <HistoryComboBox.hpp>
 #include <vssym32.h>
 #include <vssym32.h>
 
 
 #include "Animations96.h"
 #include "Animations96.h"
@@ -2104,4 +2105,8 @@ void __fastcall FindComponentClass(
   {
   {
     ComponentClass = __classid(TUIStateAwareLabel);
     ComponentClass = __classid(TUIStateAwareLabel);
   }
   }
+  else if (ComponentClass == __classid(TComboBox))
+  {
+    ComponentClass = __classid(TUIStateAwareComboBox);
+  }
 }
 }