Solved

delphi FormShow(Sender: TObject);

Posted on 2011-02-21
7
1,901 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 300 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 37

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 100 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 100 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

Independent Software Vendors: 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

Suggested Solutions

Title # Comments Views Activity
delphi parse string to params 3 152
Delphi and Access based Enumeration 9 77
Breakpoint doesn't stop in my variable 3 36
Firemonkey BASS_Init into a thread 17 53
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

740 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