[Lazarus] What is main form? (Splash question)

Vojtěch Čihák vojtech.cihak at atlas.cz
Fri May 8 21:59:43 CEST 2015


Thanks,
 
the sleep() was there because demo is simple and is executed too fast and I needed to see whether splash is actually displayed.
In the real project I will not use sleep() in *.lpr nor elsewhere. I don't want to waste user's time :) 
 
______________________________________________________________
> Od: Mattias Gaertner <nc-gaertnma at netcologne.de>
> Komu: <lazarus at lists.lazarus.freepascal.org>
> Datum: 08.05.2015 21:52
> Předmět: Re: [Lazarus] What is main form? (Splash question)
>
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

--
_______________________________________________
Lazarus mailing list
Lazarus at lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus <http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20150508/26fdf7b7/attachment-0003.html>


More information about the Lazarus mailing list