Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exceptions, application events and child windows 2

Status
Not open for further replies.

WETFOX

Programmer
Jun 23, 2002
61
SA
Hi there! I am completely newbie and needs help from experts like you. I'm using delphi7 under Win2k Adv. Server and initially coded my application using MS ACCESS database as backend

I Have 2 simple qestions:


1. I pasted an application event component in my datamodule to make it visible to all modules. I did this to trap any database-related errors that may occur in any of the modules. How can I avoid displaying the default Delphi exceptions and just display my own error message. I've tried but what happened is that the Delphi exceptions error appears first and when I close it, my customized error message appears next.

2. How can I avoid displaying the same child window in my MDI application when I clicked a button that creates it? I have a code something like this in my form's button:

application.createform(TfrmX,frmX); //frmX is a child window
frmX.show;

How can I test if frmX is already loaded and active so I can avoid creating it again?

Thanks for shedding a little light....

ERA
era@nittsu.com.ph
era@digitelone.com
 
question 1
are you using the TApplicationEvents OnException Event ??

question 2
Code:
if myForm = nil then
 myForm := TMyForm.Create(Application);

make sure you free the form and set it to nill on close.


Aaron
 
hi aaronjme. On q1 yeah, I'm using tapplication events on exceptions.

on q2..i'll try your suggestion..than u vry much!!!

ERA
era@nittsu.com.ph
era@digitelone.com
 
On question 1, it sounds as though you have the "Stop on Delphi Exceptions" option switched on. This is found under the Tools|Debugger Options menu, on the Language Exceptions tab (it may be different on Delphi 7).
When this is switched on and you are running your application through the debugger then when an exception occurs, execution will halt and the standard Delphi error will be shown before any exception handling that you have written is executed.
If you switch this optino off, or run your app by just running the exe then the Delphi message shouldn't appear.
 
thanks aaronjme for very hekpful ans on my Q2. I tested it and my app is running the way I wanted it to be. And also to u donvittorio for letting me know it....I gave both of u a star

ERA
era@nittsu.com.ph
era@digitelone.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top