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

Tommi Prami tommi.prami at gmail.com
Thu Mar 21 08:46:49 CET 2013


OK,

This was not issue of the TTrayIcon at all,..

First I forgot the Release Compiling option so Brake points did not 
work, I mainly work with Delphi and not been using Lazarus for awhile... 
Even it is very familiar, but some things are different (and that is OK...)

And couple other issues that I did not see coming...

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...

So I took the If out of there, so it works... (Did not check 
WindowsState, maybe that would work???)

And then the final Gotcha...

I added Start Minimized Functionality to Program and if I set minimize 
the Form and set visible to False on Forms.OnCreate Event. Form never 
comes back again.

I made Hack to start timer with Short delay, and do the minimizing of 
the Form there. After the form has been shown, then it works...

Not sure are these bugs, (In FPC/Lazarus level or even Windows) or how I 
could hide the Window without showing the Glimpse of it before...

And if I set forms Visible to False, one could think you can trust it 
stays that way

I can file bug reports if these seems to be bugs... I have simple test 
App attached, if someone what to tinker with it...

-tee-
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LazarusTrayIconTest.7z
Type: application/octet-stream
Size: 124701 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130321/db9bcb88/attachment-0002.obj>


More information about the Lazarus mailing list