Solved

delphi FormShow(Sender: TObject);

Posted on 2011-02-21
7
1,827 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 36

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

757 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

13 Experts available now in Live!

Get 1:1 Help Now