Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Hiding my window immediately after the OnShow event...

Posted on 1999-08-07
10
Medium Priority
?
286 Views
Last Modified: 2010-04-04
Hello.
I absolutely need to hide my main window immediately after the OnShow event has finished being processed (as I cannot call Hide from within MyForm.FormShow.
How to do that? I cannot set ShowMainWindow to False in the project source, because in this way OnShow is not processed!
Thanks in advance,
Mauro.
0
Comment
Question by:mauromol
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
10 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1393462
hi mauromol,

why can't you the code in your onShow-Event move or copy to the OnCreate-Event ?

meikl
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1393463
hi mauromol,

you can set ShowMainWindow to False
and call your Show-procedure byself like this sample

procedure TForm1.FormShow(Sender: TObject);
begin
  //or whatever code
  form2 := TForm2.Create(Application);
  Form2.show;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.ShowMainForm := False;
  Formshow(Self);
end;

meikl
0
 

Author Comment

by:mauromol
ID: 1393464
I solved the problem in this way: I call MyForm.Hide from OnPaint event handler.
But, as I would need to hide the form without having to set its WindowState to wsNormal or wsMaximized (as the application starts with the main window with WindowState set to wsMinimized), if someone has a more elegant way to solve the problem, he's welcome.
Infact now I have to change the WindowState to wsNormal in order to make OnPaint be called: the window "flashes" on the center of the screen before being hidden...
Mauro.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:mauromol
ID: 1393465
Oh, I forgot: I cannot move the code from OnShow event handler to OnCreate one, as I working with the components of my form, so I think that at MyForm.OnCreate time its components are not fully set up yet, are they?
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1393466
Move your code to the OnCreate event. This event is called after the form has been created and all components have been read in.

Cheers,

Raymond.

0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1393467
raymond, as i suggested first ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1393468
appendix, my answer was a elegant solution, or not ?
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1393469
Oops, sorry meikl. I did explain why that would work though...

mauromol: If you move your code to the OnCreate event you should reject my answer and allow kretschmar to answer it.

Cheers,

Raymond.

0
 

Author Comment

by:mauromol
ID: 1393470
kretschmar, please propose your comment to move the OnShow event code to OnCreate as an answer and I will accept it.
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 450 total points
ID: 1393471
well, mauromol,

glad that the move of the code from the OnShow-Event
to the OnCreate-Event solved your problem.

good luck again

meikl
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question