Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Caling method in unit that uses formA before formA shown?

2 views
Skip to first unread message

TomCorcora

unread,
Sep 9, 1996, 3:00:00 AM9/9/96
to

Hi,

I have the following problem:

unit Unit1;
...
uses Unit2;
...
procedure FormA.FormCreate(Sender: TObject);
begin
...
ReadFromINIFile;
...
end;

Unit2

procedure ReadFromIniFile;
begin
...
FormA.ChkThis (*********Problem*************)
end;

The variable FormA is not assigned until after the formCreate is finished.
It seems that the OnCreate also calls the OnShow and OnActivate so they
won't work either for the same reason. I would prefer not to have to move
ReadFromINIFile to Unit1.

Has anyone got any ideas?

Thanks.

Tom.

Rowland Shaw

unread,
Sep 11, 1996, 3:00:00 AM9/11/96
to TomCorcora

Only an idea:
Try moving it to OnShow() or OnActivate(), I had this problem a while
back, and fixed it like this. BTW I believe that Onshow is called
*after* OnCreate...

Any help
Rowland
--
============================================+===========================
Uni: mailto:***************** | Always be sincere -
Home: mailto:Row...@netcomuk.co.uk | Whether you mean it or not
Web: http://www.netcomuk.co.uk/~rowland/ |

john atkins

unread,
Sep 12, 1996, 3:00:00 AM9/12/96
to

OnShow and OnActivate can be called many times so it is necessary to have
a "FirstEntry flag" to stop initialisation code being executed many times.

John.

0 new messages