Wikia

Delphi Programming

Message handler completion

Talk3
2,909pages on
this wiki

Let's say you want to implement a control that handles the Windows Unit message WM_Paint in a particular way. Do you know how that message handler needs to be declared? Which type the Message parameter must be? Neither do I, but Delphi does and can help you there:

type
  TMyControl = class(TWinControl)
  private
    <press ctrl-space here>
  end;

If you press ctrl-space at the position marked above, you will get a list of all message handlers and more stuff. To see only the message handlers, type "wm". And to find wm_Paint - you guessed it - add a "p". Press return and you will get the following:

type
  TMyControl = class(TWinControl)
  private
    procedure WMPaint(Message: TWMPaint); message WM_Paint;
  end;

Now all you need to do is press shift-ctrl-c to create an empty implementation of that method and add code. No more looking up the declaration in the controls unit or the online help.

To see this and other cool stuff in action, see Steve's demo

Around Wikia's network

Random Wiki