RAD Studio VCL Reference
|
Specifies the control that has focus on the form.
property ActiveControl: TWinControl;
__property TWinControl * ActiveControl;
Use ActiveControl to get or set the control that has focus on the form. Only one control can have focus at a given time in an application.
If the form does not have focus, ActiveControl is the control on the form that will receive focus when the form receives focus.
C++ Examples:
/* Place a TTimer object in the form and enter Timer1Timer in the OnTimer event. Place other controls in the form and change the active control at runtime. The following event handler responds to timer events by moving the active control one pixel to the right every 100 miliseconds: */ void __fastcall TForm1::Timer1Timer(TObject *Sender) { Timer1->Interval = 100; if (ActiveControl) ActiveControl->Left = ActiveControl->Left + 1; }
Delphi Examples:
{ Place a TTimer object in the form and enter Timer1Timer in the OnTimer event. Place other controls in the form and change the active control at runtime. The following event handler responds to timer events by moving the active control one pixel to the right every 100 miliseconds: } procedure TForm1.Timer1Timer(Sender: TObject); begin Timer1.Interval := 100; if ActiveControl <> nil then ActiveControl.Left := ActiveControl.Left + 1; end;
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|