| View previous topic :: View next topic |
| Author |
Message |
Brian Guest
|
Posted: Tue Jun 28, 2005 3:04 pm Post subject: SDI Forms: Minimize main but keep secondary open? |
|
|
I have a SDI application that contains multiple forms. When I
minimize the main form, all secondary forms get automatically
minimized. Is there a way to keep uncouple the secondary forms from
the main form such that they stay open?
Each seconday form is auto created and shown via:
SecondaryFormX->Show();
I've also tried to not autocreate the form and manually create it
via
TSecondaryFormX *form=new TSecondaryFormX(MainForm);
form->Parent=MainForm;
form->Show();
Thanks in advance for your help.
|
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Tue Jun 28, 2005 3:13 pm Post subject: Re: SDI Forms: Minimize main but keep secondary open? |
|
|
Brian wrote:
| Quote: | I have a SDI application that contains multiple forms. When I
minimize the main form, all secondary forms get automatically
minimized.
|
Yes. That is completely normal.
| Quote: | Is there a way to keep uncouple the secondary forms from
the main form such that they stay open?
|
Yes. Choose another mainform. That can be an empty TForm. Place it 'out of sight'
at startup. For instance. Left = Screen->Width; would do.
| Quote: | Each seconday form is auto created and shown via:
SecondaryFormX->Show();
|
It is autocreated in WinMain ? They are set Invisible at designtime
and made visible with Show().
| Quote: | I've also tried to not autocreate the form and manually create it
via
TSecondaryFormX *form=new TSecondaryFormX(MainForm);
form->Parent=MainForm;
form->Show();
|
Why are you asigning a Parent ? Now even if the Parent is not
the MainForm such children will minimize if the Parentwindow
minimizes.
Hans.
|
|
| Back to top |
|
 |
JD Guest
|
Posted: Tue Jun 28, 2005 4:58 pm Post subject: Re: SDI Forms: Minimize main but keep secondary open? |
|
|
"Brian" <bplotkin6 (AT) comcast (DOT) net> wrote:
| Quote: |
[...] Is there a way to keep uncouple the secondary forms
from the main form such that they stay open?
|
Yes but it means that each secondary form will have it's own
icon on the task bar. All you have to do is apply the
WS_EX_APPWINDOW flag to the Form's ExStyle and assign the
desktop as the parent. This is accomplished by overriding the
form's CreateParams method:
//--- in the header -------------------------------------------
protected:
virtual void __fastcall CreateParams( TCreateParams &Params );
//--- in the unit ---------------------------------------------
void __fastcall TForm1::CreateParams(TCreateParams &Params)
{
TForm::CreateParams( Params );
Params.ExStyle |= WS_EX_APPWINDOW;
Params.WndParent = GetDesktopWindow();
}
~ JD
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Jun 28, 2005 5:16 pm Post subject: Re: SDI Forms: Minimize main but keep secondary open? |
|
|
"Hans Galema" <notused (AT) notused (DOT) nl> wrote
| Quote: | Yes. Choose another mainform. That can be an empty TForm.
Place it 'out of sight' at startup. For instance. Left = Screen->Width;
would do.
|
Or just simply set the Application->ShowMainForm property to false before
Application->Run() is called.
Gambit
|
|
| Back to top |
|
 |
|