Code-completion doesn't list message handlers

荒凉一梦 提交于 2019-12-23 12:16:51

问题


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:

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


回答1:


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;

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.



来源:https://stackoverflow.com/questions/16639555/code-completion-doesnt-list-message-handlers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!