Hello. I am using the Borland c++ builder. I have an application where I want the main form to be hidden until a button is pressed on a different form. i have set the Visible value on the mainform to false, but it still shows up when i run the program. anyone know what to do?
+1
A:
There is a demo that comes with C++Builder that does this It can be found in demos\cpp\apps\twoforms
"First" is the form with the button that shows "Second"
The button's OnClick event handler creates the new form with new, then calls ShowModal() You can use just Show() if it isn't meant to be a modal form.
David Dean - Embarcadero
2010-08-10 19:49:10
+1
A:
Have a look at the TApplication ShowMainForm property.
Here is an example based on the instructions in online help.
Set the main form Visible property to false.
On the menu select Project -> View Source to display the main project file.
Add the following code after the call to Application->CreateForm and before the call to Application->Run.
Application->ShowMainForm = false;
You should end up with something like this.
try
{
Application->Initialize();
Application->MainFormOnTaskBar = true;
Application->CreateForm(__classid(TMainForm), &MainForm);
// extra code to hide main form
Application->ShowMainForm = false;
Application->Run();
}
stukelly
2010-08-11 22:15:09
Thanks a bunch!
Ben313
2010-08-12 02:33:48