Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Making the startup form invisible???

This topic is 5961 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi How can I make the startup form invisible, I tried to set its visible property to false but it did not work, any ideas are greatly appreciated. Thanks

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Try this:
In delphi menu, click on "project", "view source".
Before the Application.Run; line, put
Application.ShowMainForm := FALSE;

By the way, if you want to see other form appearing at program startup instead the form1, just invert the lines:

Application.CreateForm(TForm1, Form1); // Form1 will appear at program startup
Application.CreateForm(TForm2, Form2);

Application.CreateForm(TForm2, Form2); // Now it''s Form2 which appears
Application.CreateForm(TForm1, Form1);

Hope this help...


Share this post

Link to post
Share on other sites
if you''re writing a tray application and don''t want any forms to show up, go to the "OnCreate" event of your form and add the following line:

Form1.Left := Screen.Width;

This is ugly but it works. If you want to make sure that you form doesn''t show up even if a user changes his or her resolution while the program is running, try

Form1.Left := Screen.Width * 10;

To show your form again, eg. when a hotkey is pressed, simply do the following:

Form1.Left := (Screen.Width - Form1.Width) div 2;

Share this post

Link to post
Share on other sites
Thanks guys.

Anonymous Poster: if i use your method how can i show my form a gain??

Share this post

Link to post
Share on other sites
Every Form has to methods:

// makes the form visible
// makes the form invisible

Calling those two would be absolutely sufficient...

A very simple sample:

You have two forms (Form1 is main form, Form2 is another form).
Every form just holds one button, called Button1 in both cases.
On program startup, only Form1 is visible. If the user presses the button, Form1 should be hidden and Form2 displayed instead (and the other way round if the user presses the button on Form2).

The extract of the code (the whenclickedon-events of the Buttons) would look like the following:

// in Unit1.pas
procedure TForm1.Button1Click( Sender : TObject );

// in Unit2.pas
procedure TForm2.Button1Click( Sender : TObject );

Of course, if you want to quit program, you would have to call the "close"-method on the MAIN form, that would mean Form1 in this example!

Hope I could help ...



--si tacuisses, philosophus mansisses--

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!