From: <ah...@us...> - 2010-08-17 13:22:15
|
Revision: 12825 http://jvcl.svn.sourceforge.net/jvcl/?rev=12825&view=rev Author: ahuser Date: 2010-08-17 13:22:07 +0000 (Tue, 17 Aug 2010) Log Message: ----------- Fix for calling SetFocus on a control that can't be focused because the user closed the form by pressing ESC. Modified Paths: -------------- trunk/jvcl/run/JvDBLookupTreeView.pas Modified: trunk/jvcl/run/JvDBLookupTreeView.pas =================================================================== --- trunk/jvcl/run/JvDBLookupTreeView.pas 2010-08-13 21:40:56 UTC (rev 12824) +++ trunk/jvcl/run/JvDBLookupTreeView.pas 2010-08-17 13:22:07 UTC (rev 12825) @@ -214,6 +214,7 @@ procedure CloseUp(Accept: Boolean); procedure DropDown; procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override; + function CanFocusEx: Boolean; property KeyValue; property ListVisible: Boolean read FListVisible; property Text: string read FText; @@ -997,12 +998,6 @@ FAlignment := taLeftJustify; end; Invalidate; - - - - - - end; procedure TJvDBLookupTreeViewCombo.ListLinkActiveChanged; @@ -1011,6 +1006,19 @@ KeyValueChanged; end; +function TJvDBLookupTreeViewCombo.CanFocusEx: Boolean; +var + P: TWinControl; +begin + P := Parent; + Result := Visible and Enabled; + while Result and (P <> nil) do + begin + Result := P.Visible and P.Enabled; + P := P.Parent; + end; +end; + procedure TJvDBLookupTreeViewCombo.CloseUp(Accept: Boolean); var ListValue: Variant; @@ -1020,7 +1028,8 @@ if GetCapture <> 0 then SendMessage(GetCapture, WM_CANCELMODE, 0, 0); ListValue := FDataList.GetValue; - SetFocus; + if CanFocusEx then + SetFocus; FDataList.Hide; { SetWindowPos(FDataList.Handle, 0, 0, 0, 0, 0, SWP_NOZORDER or SWP_NOMOVE or SWP_NOSIZE or SWP_NOACTIVATE or SWP_HIDEWINDOW); } @@ -1320,7 +1329,6 @@ FTree.BorderStyle := bsNone; FTree.HideSelection := False; FTree.TabStop := False; -// FTree.OnDblClick := OnDblClick2; end; destructor TJvTreePopupDataList.Destroy; @@ -1725,7 +1733,6 @@ inherited FocusKilled(NextWnd); end; - {added by zelen} {$IFDEF JVCLThemesEnabled} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |