mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-15 15:55:56 +01:00
Bug fix #92
This commit is contained in:
parent
261c6c9ba5
commit
3f94588897
@ -97,20 +97,13 @@ type
|
||||
procedure chrmosrAfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure chrmosrClose(Sender: TObject; const browser: ICefBrowser; out Result: Boolean);
|
||||
procedure chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure chrmosrTooltip(Sender: TObject; const browser: ICefBrowser; var text: ustring; out Result: Boolean);
|
||||
procedure chrmosrBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; var popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var noJavascriptAccess: Boolean; out Result: Boolean);
|
||||
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
procedure AddressEdtEnter(Sender: TObject);
|
||||
procedure SnapshotBtnClick(Sender: TObject);
|
||||
procedure SnapshotBtnEnter(Sender: TObject);
|
||||
procedure chrmosrTooltip(Sender: TObject; const browser: ICefBrowser;
|
||||
var text: ustring; out Result: Boolean);
|
||||
procedure chrmosrBeforePopup(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl,
|
||||
targetFrameName: ustring;
|
||||
targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean;
|
||||
var popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo;
|
||||
var client: ICefClient; var settings: TCefBrowserSettings;
|
||||
var noJavascriptAccess: Boolean; out Result: Boolean);
|
||||
|
||||
protected
|
||||
FPopUpBitmap : TBitmap;
|
||||
@ -125,10 +118,17 @@ type
|
||||
FMouseWheelService : IFMXMouseService;
|
||||
{$ENDIF}
|
||||
|
||||
FLastClickCount : integer;
|
||||
FLastClickTime : integer;
|
||||
FLastClickPoint : TPointF;
|
||||
FLastClickButton : TMouseButton;
|
||||
|
||||
procedure LoadURL;
|
||||
function getModifiers(Shift: TShiftState): TCefEventFlags;
|
||||
function GetButton(Button: TMouseButton): TCefMouseButtonType;
|
||||
function SendCompMessage(aMsg : cardinal; wParam : cardinal = 0; lParam : integer = 0) : boolean;
|
||||
procedure InitializeLastClick;
|
||||
function CancelPreviousClick(const x, y : single; var aCurrentTime : integer) : boolean;
|
||||
|
||||
public
|
||||
procedure DoResize;
|
||||
@ -207,6 +207,8 @@ begin
|
||||
FClosing := False;
|
||||
FResizeCS := TCriticalSection.Create;
|
||||
|
||||
InitializeLastClick;
|
||||
|
||||
{$IFDEF DELPHI17_UP}
|
||||
if TPlatformServices.Current.SupportsPlatformService(IFMXMouseService) then
|
||||
FMouseWheelService := TPlatformServices.Current.GetPlatformService(IFMXMouseService) as IFMXMouseService;
|
||||
@ -343,15 +345,28 @@ procedure TFMXExternalPumpBrowserFrm.Panel1MouseDown(Sender : TObject;
|
||||
X, Y : Single);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
TempTime : integer;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) and not(ssShift in Shift) then
|
||||
begin
|
||||
Panel1.SetFocus;
|
||||
|
||||
if not(CancelPreviousClick(x, y, TempTime)) and (Button = FLastClickButton) then
|
||||
inc(FLastClickCount)
|
||||
else
|
||||
begin
|
||||
FLastClickPoint.x := x;
|
||||
FLastClickPoint.y := y;
|
||||
FLastClickCount := 1;
|
||||
end;
|
||||
|
||||
FLastClickTime := TempTime;
|
||||
FLastClickButton := Button;
|
||||
|
||||
TempEvent.x := round(X);
|
||||
TempEvent.y := round(Y);
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), False, 1);
|
||||
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), False, FLastClickCount);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -359,11 +374,15 @@ procedure TFMXExternalPumpBrowserFrm.Panel1MouseLeave(Sender: TObject);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
TempPoint : TPoint;
|
||||
TempTime : integer;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
|
||||
begin
|
||||
GetCursorPos(TempPoint);
|
||||
TempPoint := Panel1.ScreenToclient(TempPoint);
|
||||
TempPoint := Panel1.ScreenToclient(TempPoint);
|
||||
|
||||
if CancelPreviousClick(TempPoint.x, TempPoint.y, TempTime) then InitializeLastClick;
|
||||
|
||||
TempEvent.x := TempPoint.x;
|
||||
TempEvent.y := TempPoint.y;
|
||||
TempEvent.modifiers := GetCefMouseModifiers;
|
||||
@ -376,9 +395,12 @@ procedure TFMXExternalPumpBrowserFrm.Panel1MouseMove(Sender : TObject;
|
||||
X, Y : Single);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
TempTime : integer;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
|
||||
begin
|
||||
if CancelPreviousClick(x, y, TempTime) then InitializeLastClick;
|
||||
|
||||
TempEvent.x := round(X);
|
||||
TempEvent.y := round(Y);
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
@ -398,7 +420,7 @@ begin
|
||||
TempEvent.x := round(X);
|
||||
TempEvent.y := round(Y);
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), True, 1);
|
||||
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), True, FLastClickCount);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -860,6 +882,29 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TFMXExternalPumpBrowserFrm.InitializeLastClick;
|
||||
begin
|
||||
FLastClickCount := 0;
|
||||
FLastClickTime := 0;
|
||||
FLastClickPoint.x := 0;
|
||||
FLastClickPoint.y := 0;
|
||||
FLastClickButton := TMouseButton.mbLeft;
|
||||
end;
|
||||
|
||||
function TFMXExternalPumpBrowserFrm.CancelPreviousClick(const x, y : single; var aCurrentTime : integer) : boolean;
|
||||
begin
|
||||
{$IFDEF MSWINDOWS}
|
||||
aCurrentTime := GetMessageTime;
|
||||
|
||||
Result := (abs(FLastClickPoint.x - x) > (GetSystemMetrics(SM_CXDOUBLECLK) div 2)) or
|
||||
(abs(FLastClickPoint.y - y) > (GetSystemMetrics(SM_CYDOUBLECLK) div 2)) or
|
||||
(cardinal(aCurrentTime - FLastClickTime) > GetDoubleClickTime);
|
||||
{$ELSE}
|
||||
aCurrentTime := 0;
|
||||
Result := False;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TFMXExternalPumpBrowserFrm.SnapshotBtnClick(Sender: TObject);
|
||||
begin
|
||||
if SaveDialog1.Execute then Panel1.SaveToFile(SaveDialog1.FileName);
|
||||
|
@ -122,6 +122,7 @@ object OSRExternalPumpBrowserFrm: TOSRExternalPumpBrowserFrm
|
||||
OnMouseLeave = Panel1MouseLeave
|
||||
end
|
||||
object chrmosr: TChromium
|
||||
OnTooltip = chrmosrTooltip
|
||||
OnBeforePopup = chrmosrBeforePopup
|
||||
OnAfterCreated = chrmosrAfterCreated
|
||||
OnBeforeClose = chrmosrBeforeClose
|
||||
|
@ -96,33 +96,35 @@ type
|
||||
procedure chrmosrAfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure chrmosrClose(Sender: TObject; const browser: ICefBrowser; out Result: Boolean);
|
||||
procedure chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure chrmosrTooltip(Sender: TObject; const browser: ICefBrowser; var text: ustring; out Result: Boolean);
|
||||
procedure chrmosrBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; var popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var noJavascriptAccess: Boolean; out Result: Boolean);
|
||||
|
||||
procedure SnapshotBtnClick(Sender: TObject);
|
||||
procedure SnapshotBtnEnter(Sender: TObject);
|
||||
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
procedure ComboBox1Enter(Sender: TObject);
|
||||
procedure chrmosrBeforePopup(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl,
|
||||
targetFrameName: ustring;
|
||||
targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean;
|
||||
var popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo;
|
||||
var client: ICefClient; var settings: TCefBrowserSettings;
|
||||
var noJavascriptAccess: Boolean; out Result: Boolean);
|
||||
|
||||
protected
|
||||
FPopUpBitmap : TBitmap;
|
||||
FPopUpRect : TRect;
|
||||
FShowPopUp : boolean;
|
||||
FResizing : boolean;
|
||||
FPendingResize : boolean;
|
||||
FCanClose : boolean;
|
||||
FClosing : boolean;
|
||||
FResizeCS : TCriticalSection;
|
||||
FPopUpBitmap : TBitmap;
|
||||
FPopUpRect : TRect;
|
||||
FShowPopUp : boolean;
|
||||
FResizing : boolean;
|
||||
FPendingResize : boolean;
|
||||
FCanClose : boolean;
|
||||
FClosing : boolean;
|
||||
FResizeCS : TCriticalSection;
|
||||
|
||||
FLastClickCount : integer;
|
||||
FLastClickTime : integer;
|
||||
FLastClickPoint : TPoint;
|
||||
FLastClickButton : TMouseButton;
|
||||
|
||||
function getModifiers(Shift: TShiftState): TCefEventFlags;
|
||||
function GetButton(Button: TMouseButton): TCefMouseButtonType;
|
||||
procedure DoResize;
|
||||
procedure InitializeLastClick;
|
||||
function CancelPreviousClick(x, y : integer; var aCurrentTime : integer) : boolean;
|
||||
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
@ -542,6 +544,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.chrmosrTooltip(Sender: TObject; const browser: ICefBrowser; var text: ustring; out Result: Boolean);
|
||||
begin
|
||||
Panel1.hint := text;
|
||||
Panel1.ShowHint := (length(text) > 0);
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.ComboBox1Enter(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(False);
|
||||
@ -635,6 +644,8 @@ begin
|
||||
FCanClose := False;
|
||||
FClosing := False;
|
||||
FResizeCS := TCriticalSection.Create;
|
||||
|
||||
InitializeLastClick;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.FormDestroy(Sender: TObject);
|
||||
@ -677,16 +688,29 @@ end;
|
||||
procedure TOSRExternalPumpBrowserFrm.Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
TempTime : integer;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) and not(ssShift in Shift) then
|
||||
begin
|
||||
Panel1.SetFocus;
|
||||
|
||||
if not(CancelPreviousClick(x, y, TempTime)) and (Button = FLastClickButton) then
|
||||
inc(FLastClickCount)
|
||||
else
|
||||
begin
|
||||
FLastClickPoint.x := x;
|
||||
FLastClickPoint.y := y;
|
||||
FLastClickCount := 1;
|
||||
end;
|
||||
|
||||
FLastClickTime := TempTime;
|
||||
FLastClickButton := Button;
|
||||
|
||||
TempEvent.x := X;
|
||||
TempEvent.y := Y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor);
|
||||
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), False, 1);
|
||||
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), False, FLastClickCount);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -694,11 +718,15 @@ procedure TOSRExternalPumpBrowserFrm.Panel1MouseLeave(Sender: TObject);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
TempPoint : TPoint;
|
||||
TempTime : integer;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
|
||||
begin
|
||||
GetCursorPos(TempPoint);
|
||||
TempPoint := Panel1.ScreenToclient(TempPoint);
|
||||
TempPoint := Panel1.ScreenToclient(TempPoint);
|
||||
|
||||
if CancelPreviousClick(TempPoint.x, TempPoint.y, TempTime) then InitializeLastClick;
|
||||
|
||||
TempEvent.x := TempPoint.x;
|
||||
TempEvent.y := TempPoint.y;
|
||||
TempEvent.modifiers := GetCefMouseModifiers;
|
||||
@ -710,9 +738,12 @@ end;
|
||||
procedure TOSRExternalPumpBrowserFrm.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
TempTime : integer;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
|
||||
begin
|
||||
if CancelPreviousClick(x, y, TempTime) then InitializeLastClick;
|
||||
|
||||
TempEvent.x := X;
|
||||
TempEvent.y := Y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
@ -725,13 +756,13 @@ procedure TOSRExternalPumpBrowserFrm.Panel1MouseUp(Sender: TObject; Button: TMou
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
|
||||
begin
|
||||
TempEvent.x := X;
|
||||
TempEvent.y := Y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor);
|
||||
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), True, 1);
|
||||
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), True, FLastClickCount);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -765,6 +796,24 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.InitializeLastClick;
|
||||
begin
|
||||
FLastClickCount := 0;
|
||||
FLastClickTime := 0;
|
||||
FLastClickPoint.x := 0;
|
||||
FLastClickPoint.y := 0;
|
||||
FLastClickButton := mbLeft;
|
||||
end;
|
||||
|
||||
function TOSRExternalPumpBrowserFrm.CancelPreviousClick(x, y : integer; var aCurrentTime : integer) : boolean;
|
||||
begin
|
||||
aCurrentTime := GetMessageTime;
|
||||
|
||||
Result := (abs(FLastClickPoint.x - x) > (GetSystemMetrics(SM_CXDOUBLECLK) div 2)) or
|
||||
(abs(FLastClickPoint.y - y) > (GetSystemMetrics(SM_CYDOUBLECLK) div 2)) or
|
||||
(cardinal(aCurrentTime - FLastClickTime) > GetDoubleClickTime);
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.Panel1Enter(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(True);
|
||||
|
@ -105,18 +105,25 @@ type
|
||||
procedure ComboBox1Enter(Sender: TObject);
|
||||
|
||||
protected
|
||||
FPopUpBitmap : TBitmap;
|
||||
FPopUpRect : TRect;
|
||||
FShowPopUp : boolean;
|
||||
FResizing : boolean;
|
||||
FPendingResize : boolean;
|
||||
FCanClose : boolean;
|
||||
FClosing : boolean;
|
||||
FResizeCS : TCriticalSection;
|
||||
FPopUpBitmap : TBitmap;
|
||||
FPopUpRect : TRect;
|
||||
FShowPopUp : boolean;
|
||||
FResizing : boolean;
|
||||
FPendingResize : boolean;
|
||||
FCanClose : boolean;
|
||||
FClosing : boolean;
|
||||
FResizeCS : TCriticalSection;
|
||||
|
||||
FLastClickCount : integer;
|
||||
FLastClickTime : integer;
|
||||
FLastClickPoint : TPoint;
|
||||
FLastClickButton : TMouseButton;
|
||||
|
||||
function getModifiers(Shift: TShiftState): TCefEventFlags;
|
||||
function GetButton(Button: TMouseButton): TCefMouseButtonType;
|
||||
procedure DoResize;
|
||||
procedure InitializeLastClick;
|
||||
function CancelPreviousClick(x, y : integer; var aCurrentTime : integer) : boolean;
|
||||
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
@ -645,6 +652,8 @@ begin
|
||||
FCanClose := False;
|
||||
FClosing := False;
|
||||
FResizeCS := TCriticalSection.Create;
|
||||
|
||||
InitializeLastClick;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormDestroy(Sender: TObject);
|
||||
@ -687,16 +696,29 @@ end;
|
||||
procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
TempTime : integer;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) and not(ssShift in Shift) then
|
||||
begin
|
||||
Panel1.SetFocus;
|
||||
|
||||
if not(CancelPreviousClick(x, y, TempTime)) and (Button = FLastClickButton) then
|
||||
inc(FLastClickCount)
|
||||
else
|
||||
begin
|
||||
FLastClickPoint.x := x;
|
||||
FLastClickPoint.y := y;
|
||||
FLastClickCount := 1;
|
||||
end;
|
||||
|
||||
FLastClickTime := TempTime;
|
||||
FLastClickButton := Button;
|
||||
|
||||
TempEvent.x := X;
|
||||
TempEvent.y := Y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor);
|
||||
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), False, 1);
|
||||
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), False, FLastClickCount);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -704,11 +726,15 @@ procedure TForm1.Panel1MouseLeave(Sender: TObject);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
TempPoint : TPoint;
|
||||
TempTime : integer;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
|
||||
begin
|
||||
GetCursorPos(TempPoint);
|
||||
TempPoint := Panel1.ScreenToclient(TempPoint);
|
||||
TempPoint := Panel1.ScreenToclient(TempPoint);
|
||||
|
||||
if CancelPreviousClick(TempPoint.x, TempPoint.y, TempTime) then InitializeLastClick;
|
||||
|
||||
TempEvent.x := TempPoint.x;
|
||||
TempEvent.y := TempPoint.y;
|
||||
TempEvent.modifiers := GetCefMouseModifiers;
|
||||
@ -720,11 +746,14 @@ end;
|
||||
procedure TForm1.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
TempTime : integer;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
|
||||
begin
|
||||
TempEvent.x := X;
|
||||
TempEvent.y := Y;
|
||||
if CancelPreviousClick(x, y, TempTime) then InitializeLastClick;
|
||||
|
||||
TempEvent.x := x;
|
||||
TempEvent.y := y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor);
|
||||
chrmosr.SendMouseMoveEvent(@TempEvent, False);
|
||||
@ -741,7 +770,7 @@ begin
|
||||
TempEvent.y := Y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor);
|
||||
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), True, 1);
|
||||
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), True, FLastClickCount);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -775,6 +804,24 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.InitializeLastClick;
|
||||
begin
|
||||
FLastClickCount := 0;
|
||||
FLastClickTime := 0;
|
||||
FLastClickPoint.x := 0;
|
||||
FLastClickPoint.y := 0;
|
||||
FLastClickButton := mbLeft;
|
||||
end;
|
||||
|
||||
function TForm1.CancelPreviousClick(x, y : integer; var aCurrentTime : integer) : boolean;
|
||||
begin
|
||||
aCurrentTime := GetMessageTime;
|
||||
|
||||
Result := (abs(FLastClickPoint.x - x) > (GetSystemMetrics(SM_CXDOUBLECLK) div 2)) or
|
||||
(abs(FLastClickPoint.y - y) > (GetSystemMetrics(SM_CYDOUBLECLK) div 2)) or
|
||||
(cardinal(aCurrentTime - FLastClickTime) > GetDoubleClickTime);
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1Enter(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(True);
|
||||
|
Loading…
Reference in New Issue
Block a user