Where to set FormFileName?

Hi have a form (login form) that is used as a standard form when first called, and the subsequently as a popup form.

I would like to use a different template when it is a pop up from so I have the following calling code:

LoginPage := TLoginPage.Create(Self);
  try
    LoginPage.Popup := True;
    LoginPage.PopupOpacity := 1;
    LoginPage.IsModalPopUp := True; //<<<<< the file name is set in this method, see below
    await(TWebForm, LoginPage.Load());
    LoginPage.AMessage := AMessage;
    lRetval := await(TModalResult, LoginPage.Execute);
  finally
    LoginPage.Free;
    LoginPage := nil;
  end;

and the setting is done

procedure TLoginPage.SetIsModalPopUp(const Value: Boolean);
begin
  FIsModalPopUp := Value;
  if Value then
  begin
     ElementClassName := 'PopUpForm';
     FormFileName := 'LoginAgainForm.html';
  end;
end;

but the form still uses the default file. Where should I set this?

thanks

Did you try to use the overload of CreateNew with the HTML filename param:
Form.CreateNew(HTMLFileName)

That worked, but with a weird result. At the moment the templates are identical but using

TLoginPage.Create(Self) shows

Create

and

TLoginPage.CreateNew('LoginAgainForm.html')

CreateNew

Looks like something goes wrong with setting the popup width?
Not sure where you set this popup width?

The size is set at design time. The only difference is in calling the create method. Nothing else is different, I have even run the templates in Beyond Compare just to make sure I hadn't missed anything.

//----This is all that gets changed
  LoginPage := TLoginPage.CreateNew('LoginAgainForm.html');
  LoginPage := TLoginPage.Create(Self);
//--------
  try
    LoginPage.Popup := True;
    LoginPage.PopupOpacity := 1;
    LoginPage.IsModalPopUp := True;
    await(TWebForm, LoginPage.Load());
    LoginPage.AMessage := AMessage;
    lRetval := await(TModalResult, LoginPage.Execute);
  finally
    LoginPage.Free;
    LoginPage := nil;
  end;