[Lazarus] What is main form? (Splash question)
Mattias Gaertner
nc-gaertnma at netcologne.de
Fri May 8 21:51:37 CEST 2015
On Fri, 08 May 2015 17:46:10 +0200
Vojtěch Čihák <vojtech.cihak at atlas.cz> wrote:
> Hi,
>
> what is main form from POV of Lazarus?
It is the first form created with Application.CreateForm, which
FormStyle is neither fsSplash nor fsMDIChild.
> I made this demo:
>
> program project1;
> {$mode objfpc}{$H+}
>
> uses
> {$IFDEF UNIX}{$IFDEF UseCThreads}
> cthreads,
> {$ENDIF}{$ENDIF}
> sysutils,
> Interfaces, // this includes the LCL widgetset
> Forms, Unit1, Unit2, Unit3
> { you can add units after this };
>
> {$R *.res}
>
> begin
> RequireDerivedFormResource:=True;
> Application.Initialize;
> // Application.CreateForm(TFrmSplash, FrmSplash);
Don't forget to set FrmSplash.FormStyle to fsSplash.
> // sleep(750);
On many platforms this won't work. Use
Application.ProcessMessages instead.
In general: don't use "sleep" in the main thread.
> Application.CreateForm(TFrmMain, FrmMain);
> Application.CreateForm(TForm3, Form3);
> // FrmSplash.Free;
> Application.Run;
> end.
Mattias
More information about the Lazarus
mailing list