Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code-completion doesn't list message handlers

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?

like image 919
NGLN Avatar asked Dec 27 '22 03:12

NGLN


1 Answers

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.

like image 197
NGLN Avatar answered Jan 17 '23 17:01

NGLN