Browse Source

FIX: COCOA: mouse event lost in AutoComplete Window in KASPathEdit (THintWindow) (#591)

rich2014 3 năm trước cách đây
mục cha
commit
abaa9b57f0

+ 21 - 1
components/KASToolBar/kaspathedit.pas

@@ -22,12 +22,19 @@
 unit KASPathEdit;
 unit KASPathEdit;
 
 
 {$mode delphi}
 {$mode delphi}
+{$IF DEFINED(LCLCOCOA)}
+{$modeswitch objectivec1}
+{$ENDIF}
 
 
 interface
 interface
 
 
 uses
 uses
   Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
   Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
-  ShellCtrls, LCLType, LCLVersion;
+  ShellCtrls, LCLType, LCLVersion
+{$IF DEFINED(LCLCOCOA)}
+  , CocoaAll, CocoaWindows
+{$ENDIF}
+  ;
 
 
 type
 type
 
 
@@ -294,11 +301,24 @@ begin
   FListBox.ItemIndex:= FListBox.ItemAtPos(Classes.Point(X, Y), True);
   FListBox.ItemIndex:= FListBox.ItemAtPos(Classes.Point(X, Y), True);
 end;
 end;
 
 
+{$IF DEFINED(LCLCOCOA)}
+procedure cocoaNeedMouseEvent( hintWindow: THintWindow );
+var
+  cnt: TCocoaWindowContent;
+begin
+  cnt:= TCocoaWindowContent( hintWindow.Handle );
+  cnt.window.setIgnoresMouseEvents( false );
+end;
+{$ENDIF}
+
 procedure TKASPathEdit.ShowListBox;
 procedure TKASPathEdit.ShowListBox;
 begin
 begin
   if (FPanel = nil) then
   if (FPanel = nil) then
   begin
   begin
     FPanel:= THintWindow.Create(Self);
     FPanel:= THintWindow.Create(Self);
+{$IF DEFINED(LCLCOCOA)}
+    cocoaNeedMouseEvent(FPanel);
+{$ENDIF}
     FPanel.Color:= clDefault;
     FPanel.Color:= clDefault;
     FListBox.Parent:= FPanel;
     FListBox.Parent:= FPanel;