Board index » cppbuilder » open a second form from click on a button of the main form

open a second form from click on a button of the main form


2005-08-15 12:18:42 AM
cppbuilder114
Hi ! I just want to open a second Form (Form2) from a click on a button in
the main Form (Form1). On the event OnBtnClick of Form1, I program this:
if (Form2==NULL)
Form2=new TForm2(this);
else
Form2->WindowState=wsNormal;
And in my class Form2, I wrote the CreateParams function like this:
//--------------------------------------------------------------------------
-
void __fastcall TForm2::CreateParams(TCreateParams &Params)
{
TForm::CreateParams(Params);
Params.ExStyle |=WS_EX_TOOLWINDOW;
Params.WndParent=GetDesktopWindow();
}
//--------------------------------------------------------------------------
-
My problem is when I minimize the Form2 and after I click on the button that
actives the Form2, the Form2 appears bigger than before. Or When I minimize
the Form2 and after I restore the Form2, this Form2 has the same behavior. I
really don't understand. If somebody can help me for this, thank you very
very much!! It's the first time I control a Form by clicking on a button.Is
that the good way?
Thank you very much!
Ced
 
 

Re:open a second form from click on a button of the main form

"cedric" < XXXX@XXXXX.COM >wrote in message
Quote
if (Form2==NULL)
Form2=new TForm2(this);
else
Form2->WindowState=wsNormal;
Do this instead:
if( Form2==NULL )
Form2 = new TForm2(this);
Form2->Show();
Gambit