git-svn-id: trunk@20293 -
This commit is contained in:
dmitry 2009-05-29 09:34:43 +00:00
parent 4cfb35e54c
commit e1665eb0e8
3 changed files with 35 additions and 10 deletions

View File

@ -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

View File

@ -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;
{------------------------------------------------------------------------------

View File

@ -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