From: Ketmar Dark Date: Tue, 26 Sep 2017 06:21:53 +0000 (+0300) Subject: HolmesUI: focus fixes X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=b23d093227839cca1b0c209580f5d2be3c2e3b5f;p=d2df-sdl.git HolmesUI: focus fixes --- diff --git a/src/gx/gh_ui.pas b/src/gx/gh_ui.pas index 85a4a5f..46bbbf6 100644 --- a/src/gx/gh_ui.pas +++ b/src/gx/gh_ui.pas @@ -218,6 +218,7 @@ type mFreeOnClose: Boolean; // default: false protected + procedure activated (); override; procedure blurred (); override; public @@ -1012,7 +1013,7 @@ begin if (not mEnabled) or (not mCanFocus) then exit; if (tl.mFocused <> self) then begin - tl.mFocused.blurred(); + if (tl.mFocused <> nil) then tl.mFocused.blurred(); tl.mFocused := self; if (tl.mGrab <> self) then tl.mGrab := nil; activated(); @@ -1224,7 +1225,7 @@ begin if (mWidth+mFrameWidth < ctl.mX+ctl.mWidth) then mWidth := ctl.mX+ctl.mWidth+mFrameWidth; if (mHeight+mFrameHeight < ctl.mY+ctl.mHeight) then mHeight := ctl.mY+ctl.mHeight+mFrameHeight; end; - if (mFocused = nil) and ctl.mEnabled and ctl.mCanFocus and (ctl.mWidth > 0) and (ctl.mHeight > 0) then mFocused := ctl; + //if (mFocused = nil) and ctl.mEnabled and ctl.mCanFocus and (ctl.mWidth > 0) and (ctl.mHeight > 0) then mFocused := ctl; end; @@ -1472,6 +1473,17 @@ begin end; +procedure THTopWindow.activated (); +begin + if (mFocused = nil) or (mFocused = self) then + begin + mFocused := findFirstFocus(); + if (mFocused <> nil) and (mFocused <> self) then mFocused.activated(); + end; + inherited; +end; + + procedure THTopWindow.blurred (); begin mDragging := false;