Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3953500
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:58:56+00:00 2026-05-20T01:58:56+00:00

The Delphi debugger is great for debugging linear code, where one function calls other

  • 0

The Delphi debugger is great for debugging linear code, where one function calls other functions in a predictable, linear manner, and we can step through the program line by line.

I find the debugger less useful when dealing with event driven gui code, where a single line of code can cause new events to be triggered, which may in turn trigger other events.
In this situation, the ‘step through the code’ approach doesn’t let me see everything that is going on.

The way I usually solve this is to 1) guess which events might be part of the problem, then 2) add breakpoints or logging to each of those events.

The problem is that this approach is haphazard and time consuming.

Is there a switch I can flick in the debugger to say ‘log all gui events’? Or is there some code I can add to trap events, something like

procedure GuiEventCalled(ev:Event)
begin
    log(ev);
    ev.call();
end

The end result I’m looking for is something like this (for example):

FieldA.KeyDown 
FieldA.KeyPress 
FieldA.OnChange 
FieldA.OnExit 
FieldB.OnEnter

This would take all the guesswork out of Delphi gui debugging.

I am using Delphi 2010

[EDIT]
A few answers suggested ways to intercept or log Windows messages. Others then pointed out that not all Delphi Events are Windows messages at all. I think it is these type of “Non Windows Message” Events that I was asking about; Events that are created by Delphi code. [/EDIT]

[EDIT2]
After reading all the information here, I had an idea to use RTTI to dynamically intercept TNotifyEvents and log them to the Event Log in the Debugging window. This includes OnEnter, OnExit, OnChange, OnClick, OnMouseEnter, OnMouseLeave events. After a bit of hacking I got it to work pretty well, at least for my use (it doesn’t log Key events, but that could be added).
I’ve posted the code here

To use

  1. Download the EventInterceptor Unit and add it to your project
  2. Add the EventInterceptor Unit to the Uses clause
  3. Add this line somewhere in your code for each form you want to track.

    AddEventInterceptors(MyForm);

Open the debugger window and any events that are called will be logged to the Event Log

[/EDIT2]

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T01:58:57+00:00Added an answer on May 20, 2026 at 1:58 am

    Use the “delphieventlogger” Unit I wrote download here. It’s only one method call and is very easy to use. It logs all TNotifyEvents (e.g. OnChange, OnEnter, OnExit) to the Delphi Event Log in the debugger window.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Since some time, my Delphi debugger became much slower than I was used to
Delphi (and probably a lot of other languages) has class helpers. These provide a
Delphi has a $WARN compiler directive that allows one to selectively enable or disable
With Delphi I wrote a DLL which can be called from Java via JNA
I have a Delphi Apache Shared Module. The base class is TWebModule. I can
Delphi 2009 has changed its string type to use 2 bytes to represent a
Delphi 2009, among some cool stuff, has also just got Anonymous methods. I've seen
Delphi 2009 introduced a hierarchical system for project options configuration, where you set base
Delphi strings use single quotes, for example ' a valid string '. How does
Delphi 8 introduced Class Helpers for the purposes of mapping the VCL/RTL to the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.