Recent

Author Topic: Cannot get tedit to be initial focus when form displayed  (Read 4462 times)

wpflum

  • Sr. Member
  • ****
  • Posts: 276
Cannot get tedit to be initial focus when form displayed
« on: September 02, 2010, 07:19:03 pm »
I have a form with a PageControl and some tabsheets on it and on the first tabsheet I have a bunch of Tedits.  I want a specific Tedit to be the initial field the cursor is in when the tabsheet is displayed but there is no setfocus in the Tedit object.  I've reset all of the tab orders so that the Tedit I want first is set to tab order 0 but tab order 1 always comes up with the cursor in.  What am I missing??


wpflum

  • Sr. Member
  • ****
  • Posts: 276
Re: Cannot get tedit to be initial focus when form displayed
« Reply #1 on: September 02, 2010, 07:22:48 pm »
I just realized I'm also going to need to know how to move the focus or tab stop in code as well since I need to verify the data in the Tedit after the user leaves the field and if the data is bad then I have to force the cursor back to the original field.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4383
  • I like bugs.
Re: Cannot get tedit to be initial focus when form displayed
« Reply #2 on: September 02, 2010, 09:29:50 pm »
When the controls are on a form then you can use Form1.ActiveControl:=...;
or Form1.FocusControl(...);

You could try if it also works for controls on tabsheet.

Juha
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018