Question

When working on an old project in Delphi XE2, the code-completion window that pops up after CTRL-SPACE does not list message handlers like Delphi 7 did:

Screen shot

In the screen shot above, the WM*** routines are missing. Why is that?

Was it helpful?

Solution

The unit names in the uses clause are not fully qualified. Include the namespace for each unit and then the necessary types for the method declarations are found to let the code-completion pop-up window return all members.

For instance:

  • procedure WMActivate(var Message: TWMActivate); will not be shown when Winapi.Messages.TWMActivate isn't found,
  • procedure CMActivate(var Message: TCMActivate); will not be shown when Vcl.Controls.TCMActivate isn't found.

Solution:

uses
  Winapi.Windows, Winapi.Messages, System.Classes, Vcl.Controls, Vcl.Forms,
  Vcl.Graphics;

enter image description here

Exactly why this is, I do not dare to explain. Especially since all other methods (not being message handlers) are shown whether the concerning unit is fully qualified or not. But it does not really matter; when working in Delphi 2009 or above, you should get accustomed to use fully qualified unit names nevertheless.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top