Solved

Strange Error: from Create automatically jump to ShowForm

Posted on 2009-07-01
7
275 Views
Last Modified: 2012-05-07
I have to re-debug a once running application.
The Error is npw /recently like this:
from the from.Create function (Line #1) to execution immeadiatly jumps to FormShow,
then calling/executing line //2 and then not executing MYForm.Show; because the form is already
visible after Form.Create.
Any ggod idea what might be the reaon ?

Form Properties:

onCreate -> CreateFunction
onShow ->FormShow Function

//1 

MyForm := MyForm.Create(Application)
 

//2

MYForm.firstProperty  := bla; 

MYForm.xxxProperty  := bla bla; 
 

MYForm.Show;

Open in new window

0
Comment
Question by:BdLm
7 Comments
 
LVL 4

Expert Comment

by:JonasMalmsten
ID: 24758741
Look at the forms Visible property in the object inspector, it is probably set to True.
0
 
LVL 8

Author Comment

by:BdLm
ID: 24758778
It is a MDI Form, can't set visible to False :-(
0
 
LVL 4

Expert Comment

by:JonasMalmsten
ID: 24758818
What are the properties you need to set before the form is shown?
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 11

Accepted Solution

by:
dougaug earned 250 total points
ID: 24758855
Does the form MyForm has the property formStyle = MdiChild?
If yes, maybe this is the cause, because MDIChild forms become visible when they are created.

Regards,
0
 
LVL 37

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 250 total points
ID: 24760613
check the OldCreateOrder property of the form
set it to false

override the constructor of the mdi child to set properties

  public
    constructor Create(AOwner: TComponent); override;
  end;

constructor TChildForm.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  // set properties here

  // visible becomes true before end (it calls formcreate first, then sets visible to true)
end;
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 24767614
Have you deleted all the DCU's and done a rebuild? Sounds like you may have an old DCU hanging out there in the path somewhere.
0
 
LVL 8

Author Comment

by:BdLm
ID: 24771746
may be I changed this Form from fsnormal to midchild without any further test ...., now changed the code , solution found
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

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…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

16 Experts available now in Live!

Get 1:1 Help Now