tab order and setfocus

I have a problem with setting focus to the first edit control on the form created. 

procedure TFrmMain.TMSFNCTreeView1NodeClick(Sender: TObject;
  ANode: TTMSFNCTreeViewVirtualNode);
  procedure AfterCreate(AForm: TObject);
    if Assigned(frm) and (frm is TfrmUserMaster) then
      (frm as TfrmUserMaster).dbusermaster.Load;
      (frm as TfrmUserMaster).selectFirst;


  if Assigned(frm) then
  frm := TfrmUserMaster.CreateNew(WebPanel4.ElementID, @AfterCreate);

I tried putting this on the after show even on the form also but has not worked. Also I have set the tab order of the input controls correctly but the cursor vanishes after I tab out of the first control and appears on the second control after two tabs. I have not been able to figure when it goes. Can you please help me out with this ?

I am currently putting together some of the important things that I require to build a full fledged app and a bit of hand holding at this stage is highly appreciated

I have retested this here using our MultiForm demo by adding an extra TWebEdit on the form and adding the code in the demo:

  // async called OnCreate for TForm2
  procedure AfterCreate(AForm: TObject);
    (AForm as TForm2).frm2Edit.Text := WebEdit1.Text;
    (AForm as TForm2).WebEdit1.SetFocus;
and this works as expected.

Thanks. Setfocus works. form.selectfirst as mentioned elsewhere in this forum does not. But after that when I tab the cursor vanishes and after two tabs appears on the second editbox. Is there a way to find out where the cursor goes or do I have to write a keypress event as you have done in the login page of the xdata app wizard ?

These tips might help you debug:

I was able to resolve the tab order issues by extracting the .SetTabOrder entries from the application javascript.  I opened the javascript in notepad and pasted it to excel where I extracted the entries.

This allowed me to assign unique sequential values to all components on all forms in the application.  It took a while but the tab sequence is now correct everywhere.

I still have issues with correct functioning when setting focus to check boxes and radio groups but the tab order issue is resolved.  I will be posting separate topics on these issues shortly.

In another thread we have confirmed we did improvements in tab handling for checkbox & radiobutton that will be included in the next update.