Solved

delphi FormShow(Sender: TObject);

Posted on 2011-02-21
7
1,839 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
7 Comments
 
LVL 32

Expert Comment

by:ewangoya
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now