Board index » delphi » Minimizing NON-main forms to the taskbar?

Minimizing NON-main forms to the taskbar?

Quote
> Turns out, only the Main form will minimize to the taskbar, and all
> others go to the desktop.

I had an intuitive feeling this might be the source of the problem. If I
understand correctly the first form you create becomes your main form.
Since I have been using the first form as a spash screen this explains the
unwanted side-effect.

Problem is, I create programs that have several "equal" forms - that is
equal in relevance. So the notion of one central main form is
inappropriate. What I would like is to associate an Application.Minimize
with these form's wsMinimized event (I presume that's the event called
when a user clicks on the generic Windows minimize icon). I've tried a
few things but can't seem to get it working.

Could anyone lend a hand with this problem? Much appreciated.

---
Cheers, Dave
Vancouver, British Columbia

 

Re:Minimizing NON-main forms to the taskbar?


Quote
On Thu, 21 May 1998, Simon R Knight wrote:
> What do you mean exactly, when you say that you have several forms
> that are equal in relevance; and that the notion of a central mainform
> is inappropriate ?

I create applications that have a main form which leads to one of six (or
more) sub-forms. These sub-forms each contain different but equally
important information. More than likely, users will be working in one of
the sub-forms rather than in the main form. The problem arises when they
want to minimize the application. Using the Windows minimize button on any
form but the main form reduced the form to a midi-child on the desktop
rather than minimizing the form (read: program) to the taskbar. This is
where I am stuck.

Quote
> The advantage of a single mainform, is that calling "Close" will
> result in all other windows being closed, and their resources freed,
> and then ultimately the mainform and application itself.

Won't calling Application.Terminate do the same thing from any form? I'm
not actually sure of this, but curious to know.

Quote
> It is not desireable for a splash screen to become an application's
> mainform though, so you need to avoid your splash screen becoming
> owned by the Application object

This was a big mistake on my part. I'm no longer making main form :=
splash screen. But is it necessary to create the splash screen myself. Why
not just use a regular Delphi form (of course, not the program's main
form) and then simply Form.Destroy after the splash screen has been shown
in order to free up the resources?

Thanks for your help.

---
Cheers, Dave
Vancouver, British Columbia

Re:Minimizing NON-main forms to the taskbar?


Quote
>>Won't calling Application.Terminate do the same thing from any form? I'm
>>not actually sure of this, but curious to know.

>I found that  "Application.Terminate" resulted in the loss of
>resources, and have used the "Close" method of the mainform ever
>since. I don't recall if this was because Application.Terminate does
>not call OnCloseQuery (which I often use to free resources), or
>whether other resources were lost also. Easy to test though !

Application.Terminate does not call OnCloseQuery.
---------------------------------------------------
boss...@remove.scm.de
http://privat.schlund.de/bossung
please remove the "remove." from me mail address
---------------------------------------------------

Re:Minimizing NON-main forms to the taskbar?


   You can minimize a secondary-form top the taskbar like this:

type
  TForm = class(TForm)
  ...
  private
    { Private declarations }
    Procedure CreateParams(Var Params: TCreateParams); Override;
  end;

implementation
...
Procedure TForm.CreateParams(Var Params: TCreateParams);
Begin
  Inherited CreateParams(Params);
  { Set the extended style for iconising to the taskbar}
  With Params Do exStyle := exStyle Or WS_EX_APPWINDOW; { See CreateWindowEx }
End;

   I have a test application on my website that demonstrates how to hide a form from the
desktop and the taskbar and put it back.  Look for TstDLL.zip in Delphi2.

--
                                                       Cleon.
                                                      <baile...@ionet.net>
                                                      <http://www.ionet.net/~baileyct>

Luck is a lifetime of practice, followed by a moment of opportunity.
People decide what they believe, then look for reasons to believe it.

David Watt <dw...@unixg.ubc.ca> wrote in article <6k2a1u$s6...@nntp.ucs.ubc.ca>...

Quote
> On Thu, 21 May 1998, Simon R Knight wrote:

> > What do you mean exactly, when you say that you have several forms
> > that are equal in relevance; and that the notion of a central mainform
> > is inappropriate ?

> I create applications that have a main form which leads to one of six (or
> more) sub-forms. These sub-forms each contain different but equally
> important information. More than likely, users will be working in one of
> the sub-forms rather than in the main form. The problem arises when they
> want to minimize the application. Using the Windows minimize button on any
> form but the main form reduced the form to a midi-child on the desktop
> rather than minimizing the form (read: program) to the taskbar. This is
> where I am stuck.

> > The advantage of a single mainform, is that calling "Close" will
> > result in all other windows being closed, and their resources freed,
> > and then ultimately the mainform and application itself.

> Won't calling Application.Terminate do the same thing from any form? I'm
> not actually sure of this, but curious to know.

> > It is not desireable for a splash screen to become an application's
> > mainform though, so you need to avoid your splash screen becoming
> > owned by the Application object

> This was a big mistake on my part. I'm no longer making main form :=
> splash screen. But is it necessary to create the splash screen myself. Why
> not just use a regular Delphi form (of course, not the program's main
> form) and then simply Form.Destroy after the splash screen has been shown
> in order to free up the resources?

> Thanks for your help.

> ---
> Cheers, Dave
> Vancouver, British Columbia

Re:Minimizing NON-main forms to the taskbar?


   You can minimize a secondary-form top the taskbar like this:

type
  TForm = class(TForm)
  ...
  private
    { Private declarations }
    Procedure CreateParams(Var Params: TCreateParams); Override;
  end;

implementation
.....
Procedure TForm.CreateParams(Var Params: TCreateParams);
Begin
  Inherited CreateParams(Params);
  { Set the extended style for iconising to the taskbar}
  With Params Do exStyle := exStyle Or WS_EX_APPWINDOW; { See CreateWindowEx }
End;

   I have a test application on my website that demonstrates how to hide a form from the
desktop and the taskbar and put it back.  Look for TstDLL.zip in Delphi2.

--
                                                       Cleon.
                                                      <baile...@ionet.net>
                                                      <http://www.ionet.net/~baileyct>

Luck is a lifetime of practice, followed by a moment of opportunity.
People decide what they believe, then look for reasons to believe it.

David Watt <dw...@unixg.ubc.ca> wrote in article <6k2a1u$s6...@nntp.ucs.ubc.ca>...

Quote
> On Thu, 21 May 1998, Simon R Knight wrote:

> > What do you mean exactly, when you say that you have several forms
> > that are equal in relevance; and that the notion of a central mainform
> > is inappropriate ?

> I create applications that have a main form which leads to one of six (or
> more) sub-forms. These sub-forms each contain different but equally
> important information. More than likely, users will be working in one of
> the sub-forms rather than in the main form. The problem arises when they
> want to minimize the application. Using the Windows minimize button on any
> form but the main form reduced the form to a midi-child on the desktop
> rather than minimizing the form (read: program) to the taskbar. This is
> where I am stuck.

> > The advantage of a single mainform, is that calling "Close" will
> > result in all other windows being closed, and their resources freed,
> > and then ultimately the mainform and application itself.

> Won't calling Application.Terminate do the same thing from any form? I'm
> not actually sure of this, but curious to know.

> > It is not desireable for a splash screen to become an application's
> > mainform though, so you need to avoid your splash screen becoming
> > owned by the Application object

> This was a big mistake on my part. I'm no longer making main form :=
> splash screen. But is it necessary to create the splash screen myself. Why
> not just use a regular Delphi form (of course, not the program's main
> form) and then simply Form.Destroy after the splash screen has been shown
> in order to free up the resources?

> Thanks for your help.

> ---
> Cheers, Dave
> Vancouver, British Columbia

Other Threads