Solved

delphi FormShow(Sender: TObject);

Posted on 2011-02-21
7
1,876 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
proper way to parse text with delphi 7 137
oracle global variables 4 76
drawing animated level bar based on numbers 3 103
DBGrid or StringGrid ? 6 103
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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 quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

765 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