Board index » delphi » Help with a GPF

Help with a GPF

I have an app with two forms.

MainForm     a MDIform and
DatabaseForm a MDIchild

The Databaseform contains a listbox (DatabaseListBox)

The MainForm FormCreate conains the following code ...

{ FormCreate is called when the form is created }
procedure TMainForm.FormCreate(Sender: TObject);
begin
  Session.GetDatabaseNames(DatabaseForm.DatabaseListBox.Items);
end;

The app compiles and links OK, BUT when I go to run it
I get a GPF of 0001:03A3 at ...

  Session.GetDatabaseNames(DatabaseForm.DatabaseListBox.Items);

Can any one help me.

Regards from Ian.
--
                     ||||||||
                     | ~  ~ |
                    (| @  @ |)
----------------oOOo---(__)---oOOo------------------------
| Ian - "Smoke me a kipper I'll be back for breakfast !" |
|                                                        |
| EMail IanMa...@breallon.demon.co.uk    Banco Real s.a. |
|                                        (London Branch) |
----------------------------------------------------------

 

Re:Help with a GPF


Ian A. Macey (IanMa...@breallon.demon.co.uk) wrote:
: I have an app with two forms.

: MainForm     a MDIform and
: DatabaseForm a MDIchild

: The Databaseform contains a listbox (DatabaseListBox)

: The MainForm FormCreate conains the following code ...

: { FormCreate is called when the form is created }
: procedure TMainForm.FormCreate(Sender: TObject);
: begin
:   Session.GetDatabaseNames(DatabaseForm.DatabaseListBox.Items);
: end;

: The app compiles and links OK, BUT when I go to run it
: I get a GPF of 0001:03A3 at ...

:   Session.GetDatabaseNames(DatabaseForm.DatabaseListBox.Items);

If you attempt to address a component for which an appropriately typed
variable exists, but which has not yet been created, this will generate
a GPF. I have seen this occur in respect to data-aware components and
components in general when addressing them in a manner along these lines
(filling with data, as opposed to just setting properties) when the
operation was performed in the parent form's OnCreate event procedure.
This would concern the order in which forms and contained components are
created versus when the OnCreate event actually gets triggered versus
when something is actually created or a message is sent to create it.

All of these situations execute without error if the problem command is
moved instead into the parent form's OnShow event procedure. By that
time, all components for the form have been created, DLLs loaded, data-
base connections completed, and you should be able to fill the component's
data container.

--
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_/ Steve Koterski               _/   The opinions expressed here are    _/
_/ koter...@borland.com         _/         exclusively my own           _/
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

Other Threads