Board index » cppbuilder » SDI Forms: Minimize main but keep secondary open?

SDI Forms: Minimize main but keep secondary open?


2005-06-28 11:04:28 PM
cppbuilder6
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.
 
 

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.
 

Re:SDI Forms: Minimize main but keep secondary open?

"Brian" < XXXX@XXXXX.COM >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
 

{smallsort}

Re:SDI Forms: Minimize main but keep secondary open?

"Hans Galema" < XXXX@XXXXX.COM >wrote in message
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