RAD Studio |  |

Example: Overriding a Message Handler

For example, to override a component's handling of the WM_PAINT message, you redeclare the WMPaint method:

Copy Code

    type
      TMyComponent = class(...)
      .
      .
      .
      procedure WMPaint(var Message: TWMPaint); message WM_PAINT;
    end;

Copy Code

    class PACKAGE TMyComponent : public TComponent
    {
    protected:
        void __fastcall WMPaint(TWMPaint* Message);
    BEGIN_MESSAGE_MAP
      MESSAGE_HANDLER(WM_PAINT, TWMPaint, WMPaint)
    END_MESSAGE_MAP(TComponent)
    };

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!