GetFocused method

Applies to
TGUITestCase

Declaration
Function GetFocused: TControl;

Implementation

function TGUITestCase.GetFocused: TControl;
var
  i :Integer;
begin
  Assert(GUI <> nil, 'GUI variable not set');

  if GUI is TCustomForm then
    Result := TCustomForm(GUI).ActiveControl
  else
  begin
    Result := nil;
    for i := 0 to GUI.ComponentCount-1 do
    begin
       if (GUI.Components[i] is TWinControl)
       and TWinControl(GUI.Components[i]).Focused then
       begin
         Result := TControl(GUI.Components[i]);
         BREAK;
       end
    end;
  end;
End;


HTML generated by Time2HELP
http://www.time2help.com