Now let's add a TcsxErrorTrapControl component to our form, as follows:
No change is required to our code to enable the error trapping. The only thing we must do is set the Error Trap Control's Enabled property to TRUE. For the purposes of our demonstration, we will leave our ButtonClick event exactly as it was in our test involving just CodeSiteEx, as seen below:
Once again, our error message is displayed:
This time, though, something useful is sent to the CodeSite viewer. Click on the thumbnail below to display the full contents of the CodeSite viewer.
By glancing at the Message Log windows, we can quickly see that an exception occurred while we were tracing the TForm1.Button1Click event. Moreover, the exception type and address are also displayed. The Inspector Pane offers more information, including the exception message text and its date / time stamp.
But what if we need to see more detailed exception information? That's when we call in the big guns and allow CodeSiteEx to interact with third party debugging utilities. It is important to note that CSX does NOT include these third party programs. You need to acquire them from their respective vendors if you wish to use them with CodeSiteEx.
Although the csxErrorTrapControl component relies on CodeSiteEx's exception notification system, it is NOT dependent upon TraceMethod. This example would have worked equally well had TraceMethod not been included in the ButtonClick event; however, the CodeSite viewer would ONLY have reported the exception then and NOT the method that the exception occurred in.