From: <jfu...@us...> - 2009-09-22 23:02:30
|
Revision: 12512 http://jvcl.svn.sourceforge.net/jvcl/?rev=12512&view=rev Author: jfudickar Date: 2009-09-22 23:02:22 +0000 (Tue, 22 Sep 2009) Log Message: ----------- Function IsSubControlFocused added Modified Paths: -------------- trunk/jvcl/run/JvJVCLUtils.pas Modified: trunk/jvcl/run/JvJVCLUtils.pas =================================================================== --- trunk/jvcl/run/JvJVCLUtils.pas 2009-09-22 14:46:54 UTC (rev 12511) +++ trunk/jvcl/run/JvJVCLUtils.pas 2009-09-22 23:02:22 UTC (rev 12512) @@ -125,6 +125,8 @@ function CreateRotatedFont(Font: TFont; Angle: Integer): HFONT; +//1 This function validates if the control or any of it subcontrols has the focus. +function IsSubControlFocused(iControl : TWinControl): Boolean; // launches the specified CPL file // format: <Filename> [,@n] or [,,m] or [,@n,m] @@ -7944,6 +7946,33 @@ end; end; +function IsSubControlFocused(iControl : TWinControl): Boolean; +var Form : TCustomForm; + Ctrl: TWinControl; +begin + Result := False; + if not Assigned(iControl) then + Exit; + if iControl.Focused then + begin + Result := True; + Exit; + end; + Form := GetParentForm(iControl); + if not Assigned (Form) then + Exit; + Ctrl := Form.ActiveControl; + while Assigned(Ctrl) do + begin + if Ctrl = iControl then + begin + Result:= true; + exit; + end; + Ctrl := Ctrl.Parent; + end; +end; + initialization {$IFDEF UNITVERSIONING} RegisterUnitVersion(HInstance, UnitVersioning); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |