Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IW15.0.14 error/change creating forms
#1
Hi,

I updated from IW15.0.13 to IW15.0.14 and saw the following error.

My application uses cookies to support autologin. The first form, TDlgLogin, checks a cookie and if it's ok, bypasses the login form by creating the next application form.
In IW15.0.14 the TDlgLogin form is showed instead of the next application form.

Very simplified the testcase is this:


Code:
type
  TIWForm1 = class(TIWAppForm)
    IWLabel1: TIWLabel;
  public
    constructor Create(aOwner: TComponent); override;
  end;

implementation

uses Unit2;

{$R *.dfm}

{ TIWForm1 }

constructor TIWForm1.Create(aOwner: TComponent);
begin
  inherited;
  // start form2
  TIWForm2.Create(WebApplication).Show;
  Release;
end;

initialization
  TIWForm1.SetAsMainForm;

end.

This testcase doesn't show TIWForm2 in IW15.0.14 while it does work in IW15.0.13

Using Delphi 10.1 Berlin
Reply
#2
Yes, in fact it worked but I'm not sure it should. This is an anti-pattern: create and show another form and, more specifically, releasing the form inside the its OnCreate event.

The recommended way of doing it would be through TIWServerController.OnGetMainForm event.
Reply
#3
Hi Alexandre,

I use the event TIWServerController.OnGetMainForm already to present a login form. Depending on the configuration and client IP address, the user is presented with a standard username/password login or one where a one-time password is generated and sent by sms.
Only the standard login form has support for auto login by using a cookie. Probably that was the reason to put the auto login logic in the TDlgLogin.Create. 
Isn't calling TIWForm.Release only to 'hide and mark the form to be released'?

I'll adapt the TIWServerController.OnGetMainForm code.

Thanks for the answer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)