How to auto focusing textField when application starts?

Comments

  1. procedure TForm1.OnCreate(Sender: TObject);
    begin
      Edit1.SetFocus;
    end;

    or 
    Change Edit1.TabOrder property In ObjectInspector
    See : http://docwiki.embarcadero.com/RADStudio/XE4/en/Edit_Tab_Order

    ReplyDelete
  2. JungHwan Jang I would put that code in the OnShow '-)

    ReplyDelete
  3. Before calling
    SetFocus, you should always call CanFocus.
    if Edit1.CanFocus() then
      Edit1.SetFocus();

    ReplyDelete
  4. Either in your OnCreate event, use:

    Self.ActiveControl := Edit1;

    Or,

    Use the property inspector to set the ActiveControl property of your form to the visual control you want to have focus ie. Edit1.

    ReplyDelete

Post a Comment