procedure TCustomForm.WndProc(var Message: TMessage);
var
FocusHandle: HWND;
SaveIndex: Integer;
MenuItem: TMenuItem;
Canvas: TCanvas;
DC: HDC;
begin
with Message do
case Msg of
WM_ACTIVATE, WM_SETFOCUS, WM_KILLFOCUS:
begin
if not FocusMessages then Exit;
if (Msg = WM_SETFOCUS) and not (csDesigning in ComponentState) then
begin
FocusHandle := 0;
{V}
// это слишком умное поведение MDI-окон мы подправим.
// ибо нефиг забирать фокус отовсюду, откуда можно...
if (FormStyle = fsMDIForm) and (ActiveMDIChild <> nil) and FRefocusMDIChild then
begin
FocusHandle := ActiveMDIChild.Handle
end
else
if (FActiveControl <> nil) and (FActiveControl <> Self) then
FocusHandle := FActiveControl.Handle;
if FocusHandle <> 0 then
begin
Windows.SetFocus(FocusHandle);
Exit;
end;
end
else
if (((Msg = WM_ACTIVATE) and (WParam = WA_INACTIVE)) or (Msg = WM_KILLFOCUS)) and not (csDesigning in ComponentState) then
begin
FRefocusMDIChild := (ActiveMDIChild <> nil) and IsChild(ActiveMDIChild.Handle, GetFocus);
end;
{/V}
end;
CM_EXIT:
if HostDockSite <> nil then DeActivate;
Комментариев нет:
Отправить комментарий