Erik Doekes
2008-07-04 18:12:51 UTC
Hi,
if messages from the ShowMessage routine are not shown although they should
be executed during the form's destructor, does this mean that something is
wrong? Or is it just too late too show messages when the form's destructor
is called?
I have a struct FileInfo whose destructor shows the message "Deleted", and
my main form contains a TList with FileInfo objects. In the form's
destructor any remaining objects in the list are deleted:
for(int i = 0; i < Files->Count; ++i)
delete (FileInfo*) Files->Items[i];
But when I close my program, still having FileInfo objects left, I don't get
to see this message
(which I do get when I delete the objects elsewhere in the program using the
same syntax).
I also tested to place the line ShowMessage("Test"); directly in the form's
destructor, and that one was not executed either.
Does this mean that everything is as it should be?
Question two: is it not recommendable to write code in the constructor and
in the onDestroy event?
(Instead of constructor+destructor / onCreate+onDestroy)
I could not find the practical difference between using the destructor and
using onDestroy in the help file, but it did recommend to use onDestroy for
deleting objects created in the form's onCreate event.
Regards,
Erik Berger
if messages from the ShowMessage routine are not shown although they should
be executed during the form's destructor, does this mean that something is
wrong? Or is it just too late too show messages when the form's destructor
is called?
I have a struct FileInfo whose destructor shows the message "Deleted", and
my main form contains a TList with FileInfo objects. In the form's
destructor any remaining objects in the list are deleted:
for(int i = 0; i < Files->Count; ++i)
delete (FileInfo*) Files->Items[i];
But when I close my program, still having FileInfo objects left, I don't get
to see this message
(which I do get when I delete the objects elsewhere in the program using the
same syntax).
I also tested to place the line ShowMessage("Test"); directly in the form's
destructor, and that one was not executed either.
Does this mean that everything is as it should be?
Question two: is it not recommendable to write code in the constructor and
in the onDestroy event?
(Instead of constructor+destructor / onCreate+onDestroy)
I could not find the practical difference between using the destructor and
using onDestroy in the help file, but it did recommend to use onDestroy for
deleting objects created in the form's onCreate event.
Regards,
Erik Berger