Cocoa: Cursor compatible with TGraphicControl

This commit is contained in:
rich2014 2023-07-28 22:50:41 +08:00
parent cbd7579c15
commit e277fcd78b

View File

@ -1866,6 +1866,22 @@ begin
end;
end;
function getWinControlAtMouse(): TControl;
begin
Result:= Application.GetControlAtMouse;
if not Assigned(Result) then
exit;
// find TWinControl (not TGraphicControl)
// see also TControl.SetTempCursor()
while not (Result is TWinControl) do
begin
Result:= Result.Parent;
if not Assigned(Result) then
exit;
end;
end;
class procedure TCocoaWSWinControl.SetCursor(const AWinControl: TWinControl;
const ACursor: HCursor);
var
@ -1883,7 +1899,7 @@ begin
// after clicking the Button.
if not ((AWinControl is TCustomForm) and (csDesigning in AWinControl.ComponentState)) then
begin
control:= Application.GetControlAtMouse;
control:= getWinControlAtMouse;
if control<>AWinControl then
exit;
end;