I'm not sure that this is a webcore issue or not, but I'm having a strange issue on a webcore page which I haven't come across before.
The page is created like this
Procedure TMainSiteForm.ShowForm(AFormClass: TWebFormClass; Const ADisplayedPage: TGadgetPage;
Const ANavDirection: TNavDirection; AProc: TFormCreatedProc = Nil; AlwaysClose: Boolean = false);
[async]
Procedure AfterFormCreated(AForm: TObject);
Begin
If AFormClass.InheritsFrom(TCoreWebForm) Then
TCoreWebForm(AForm).OnSelfClose := OnFormSelfClose;
If AFormClass.InheritsFrom(TBaseSiteForm) Then
Begin
TBaseSiteForm(AForm).NavDirection := ANavDirection;
TBaseSiteForm(AForm).OnSitePageChange := MainPageUpdate;
TBaseSiteForm(AForm).DoChangeSitePage := ChangeThePage;
TBaseSiteForm(AForm).DisplayingAs := ADisplayedPage;
Await(TBaseSiteForm(AForm).InitForm);
TBaseSiteForm(AForm).AfterLoaded;
End
Else If AFormClass.InheritsFrom(TCoreWebForm) Then
Await(TBaseSiteForm(AForm).InitForm);
HideWaitMessage;
If Assigned(AProc) Then
AProc(AForm);
End;
Begin
// Note that MainPanel is no longer a component. This now just uses a div on the template with that id.
If Assigned(FDisplayedForm) And (FDisplayedForm.ClassType = AFormClass) And (AlwaysClose = false) Then
Exit;
If Not CloseDisplayedForm(True) Then
Exit;
FDisplayedPage := ADisplayedPage;
Application.CreateForm(AFormClass, 'MainPanel', FDisplayedForm, @AfterFormCreated);
End;
After the page is loaded all the fields on the page get stepped through and the focus ends up at the bottom of the page. This all happens after the OnShow event and after my AfterLoaded method is called.
Any ideas?