codetools: fixed example addeventmethod

git-svn-id: trunk@42861 -
This commit is contained in:
mattias 2013-09-18 15:03:58 +00:00
parent 71ce8192f2
commit 012a67a370
2 changed files with 5 additions and 8 deletions

View File

@ -29,7 +29,7 @@ program AddEventMethod;
uses
Classes, SysUtils, CodeCache, CodeToolManager, SimpleUnit1, FileProcs,
CodeToolsConfig, CodeCompletionTool, ExtCtrls, Interfaces;
CodeToolsConfig, CodeCompletionTool;
const
ConfigFilename = 'codetools.config';
@ -45,12 +45,9 @@ begin
if Code=nil then
raise Exception.Create('loading failed '+Filename);
// Example 1: add a method compatible to TTabChangingEvent
// TTabChangingEvent is used in ComCtrls, but defined in ExtCtrls.
// The codetools will search TTabChangingEvent and will add ExtCtrls to the
// uses section.
// Example 1: add a method compatible to TNotifyEvent
if CodeToolBoss.CreatePublishedMethod(Code,'TForm1','NewMethod',
typeinfo(TTabChangingEvent),false,'ComCtrls') then
typeinfo(TNotifyEvent),false,'Classes') then
begin
writeln('Method added: ');
writeln(Code.Source);

View File

@ -5,10 +5,10 @@ unit AddEventExample;
interface
uses
Classes, SysUtils, Forms, Controls, ComCtrls;
Classes, SysUtils;
type
TForm1 = class(TForm)
TForm1 = class(TComponent)
PageControl1: TPageControl;
procedure Button1Click(Sender: TObject);
procedure CheckBox1Change(Sender: TObject);