mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-08 06:56:05 +02:00
parent
4cfb35e54c
commit
e1665eb0e8
@ -69,6 +69,7 @@ type
|
||||
FCurrentCursor: HCURSOR;
|
||||
FMainMenu: TMainMenu; // Main menu attached to menu bar
|
||||
FCaptureWidget: HWND; // Captured widget (TCarbonWidget descendant)
|
||||
FFocusedWidget: HWND; // Forced Focus widgetset (TCarbonWidget descendant)
|
||||
FOpenEventHandlerUPP: AEEventHandlerUPP;
|
||||
FQuitEventHandlerUPP: AEEventHandlerUPP;
|
||||
|
||||
@ -138,6 +139,8 @@ type
|
||||
public
|
||||
procedure SetCaptureWidget(const AWidget: HWND);
|
||||
procedure SetTextFractional(ACanvas: TCanvas; AEnabled: Boolean);
|
||||
procedure SetFocusedWidget(const AWidget: HWND);
|
||||
function GetFocusedWidget: HWND;
|
||||
end;
|
||||
|
||||
const
|
||||
|
@ -409,9 +409,17 @@ begin
|
||||
end;
|
||||
|
||||
if FocusPart <> kControlFocusNoPart then
|
||||
AWidget.FocusSet
|
||||
begin
|
||||
CarbonWidgetSet.SetFocusedWidget(HWND(AWidget));
|
||||
AWidget.FocusSet;
|
||||
CarbonWidgetSet.SetFocusedWidget(0);
|
||||
end
|
||||
else
|
||||
begin
|
||||
if CarbonWidgetSet.GetFocusedWidget = HWND(AWidget) then
|
||||
CarbonWidgetSet.SetFocusedWidget(0);
|
||||
AWidget.FocusKilled;
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
|
@ -1429,15 +1429,20 @@ begin
|
||||
DebugLn('TCarbonWidgetSet.GetFocus');
|
||||
{$ENDIF}
|
||||
|
||||
Window := WindowRef(GetUserFocusWindow);
|
||||
if Window = nil then Exit;
|
||||
|
||||
Control := nil;
|
||||
OSError(GetKeyboardFocus(Window, Control), Self, 'GetFocus', SGetKeyboardFocus);
|
||||
|
||||
if Control <> nil then
|
||||
Result := HWND(GetCarbonControl(Control))
|
||||
else Result := HWND(GetCarbonWindow(Window));
|
||||
if FFocusedWidget = 0 then
|
||||
begin
|
||||
Window := WindowRef(GetUserFocusWindow);
|
||||
if Window = nil then Exit;
|
||||
|
||||
Control := nil;
|
||||
OSError(GetKeyboardFocus(Window, Control), Self, 'GetFocus', SGetKeyboardFocus);
|
||||
|
||||
if Control <> nil then
|
||||
Result := HWND(GetCarbonControl(Control))
|
||||
else Result := HWND(GetCarbonWindow(Window));
|
||||
end
|
||||
else
|
||||
Result := FFocusedWidget;
|
||||
|
||||
{$IFDEF VerboseWinAPI}
|
||||
DebugLn('TCarbonWidgetSet.GetFocus Result: ' + DbgS(Result));
|
||||
@ -3517,6 +3522,15 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure TCarbonWidgetSet.SetFocusedWidget(const AWidget: HWND);
|
||||
begin
|
||||
FFocusedWidget := AWidget;
|
||||
end;
|
||||
|
||||
function TCarbonWidgetSet.GetFocusedWidget: HWND;
|
||||
begin
|
||||
Result := FFocusedWidget;
|
||||
end;
|
||||
|
||||
//##apiwiz##eps## // Do not remove, no wizard declaration after this line
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user