Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

delphi FormShow(Sender: TObject);

Posted on 2011-02-21
7
Medium Priority
?
2,028 Views
Last Modified: 2012-05-11
I can't find the root cause why a form automatically calls the show procedure in my application ....

myForm := TForm.Create(nil)

and the the form is shown ....  but why .... ??????? Myform.formstyle := fsnormal;

would like to continue the other way

myForm.ShowModal;

ig (myFirmModalresult := mrOK) then .....


----------  do not make code for me ---  just give me a hint where to look after ...
0
Comment
Question by:BdLm
[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
7 Comments
 
LVL 32

Expert Comment

by:Ephraim Wangoya
ID: 34944242

Check if the visible property is true at design time
Since you are creating it, also check to see that its not in the Auto Create form list
0
 
LVL 8

Author Comment

by:BdLm
ID: 34944326
not in auto create list   and
visible = true   -->>  sorry does not help ... any other idea ???  

made another stupid test . thats working ......

procedure TForm1.CreateForm2Click(Sender: TObject);
begin
     Form2 := Tform2.create(application);
end;

procedure TForm1.ShowFom2Click(Sender: TObject);
begin
     Form2.show;
end;
0
 
LVL 24

Accepted Solution

by:
jimyX earned 1200 total points
ID: 34945105
make sure you set visible to false: Myform.Visible := false;

Can you show your code please? I used the following code and the new form shows only when "ShowModal" is called:
var
  myForm : TForm;

procedure TForm1.Button1Click(Sender: TObject);
begin
  myForm := TForm.Create(nil);
  Myform.formstyle := fsnormal;
  myForm.ShowModal;
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
  myForm.Free;
end;

Open in new window

0
Technology Partners: 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!

 
LVL 38

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 400 total points
ID: 34945798
in your previous Q, you were changing Width, Height
did you try it without changing those properties in FormShow, FormCreate, etc ?
0
 
LVL 21

Assisted Solution

by:developmentguru
developmentguru earned 400 total points
ID: 34952927
My first test would be to comment out the line that creates Form2 and see if the form still shows at run time.  If it does then the form IS on the auto create list.

In Delphi 2010 use the Project | Options menus and click on Forms.  You should see the list of auto create forms there.  Move Form2 to the other side.

If this is not the case then seeing more of your code (all of the form1 and form2 code) would likely allow us to show you the issue.

If you change your compiler options to Use Debug DCUs then you should be able to place a breakpoint on Form2.OnShow and follow the call stack back up to the code that caused it.

Let me know if you need more.
0
 
LVL 8

Author Closing Comment

by:BdLm
ID: 34953135
jimyx: already that has been a remark in that form , but did not read it ... :-(  
geerd: already changed based on your priv. remarks, thanks
dev. guru :  now the problem is that a button is now longer visible after a Insert a element in a list .... and I get this abstract error
0
 
LVL 2

Expert Comment

by:ASta
ID: 34953747
>myForm := TForm.Create(nil)
MyForm := TMyForm.Create(nil);?
Check unit (where placed TMyForm) for Show or ShowModal call or something like?
Check all units for Show or ShowModal call?
Debug app (F7 key and breakpoints may be help you). ;)
0

Featured Post

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!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

718 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