Posts: 114
Threads: 32
Joined: Dec 2019
Reputation:
1
Location: Россия
When creating the project, the main form was created as a registration form. During the development of the project, it became necessary to show the welcome form before the registration form. The welcome form has been created in the project, but how can I assign it as the main one in the project?
Posts: 1,136
Threads: 37
Joined: Mar 2018
Reputation:
30
Location: Limassol, Cyprus
10-13-2020, 03:39 PM
(This post was last modified: 10-13-2020, 11:21 PM by kudzu.)
This call can also be made in the DPR file before the application is started. Example:
{$R *.res}
begin
TMainPage.SetAsMainForm;
TIWStart.Execute(True);
end.
Posts: 1,136
Threads: 37
Joined: Mar 2018
Reputation:
30
Location: Limassol, Cyprus
Doing so on new session is not a good idea. SetAsMainForm is a global setting and OnNewSession is threaded. This approach will create issues and could even cause crashes.
If you want to control which form is displayed dynamically use this event on the SC instead and create an instance of the form itself and return it in the var argument:
procedure TIWServerController.IWServerControllerBaseGetMainForm(var vMainForm: TIWBaseForm);
begin
end;