[Lazarus] Main Form Visibility problems (Was Should TTrayIcon Work)

Flávio Etrusco flavio.etrusco at gmail.com
Mon Mar 25 14:39:01 CET 2013


On Thu, Mar 21, 2013 at 4:46 AM, Tommi Prami <tommi.prami at gmail.com> wrote:
> (...)
>
> If I had code like this
>
> // Idea is to get rid of app from the Task Bar
> Self.WindowsState := wsMinimized;
> Self.Visible := False;
>
> And then I had in TTrayIcon event
>
> if not Self.Visible then
> begin
>   .. Try Show the form here
> end;
>
> The Seems that form thought it would be visible even I set it False just
> before...

Like in Delphi, TApplication always shows the "main form" (the first
form registered with App.AddForm) when Application.Run is called.
You must toggle Application.ShowMainForm
(http://lazarus-ccr.sourceforge.net/docs/lcl/forms/tapplication.showmainform.html).
I guess it's preferable to call it just after Application.Initialize
(in the .lpr), but maybe just calling it before Application.Run is
enough.

> (...)
> -tee-

-Flávio




More information about the Lazarus mailing list