From 012a67a37052542e09a6c57403fa9f058a608b8c Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 18 Sep 2013 15:03:58 +0000 Subject: [PATCH] codetools: fixed example addeventmethod git-svn-id: trunk@42861 - --- components/codetools/examples/addeventmethod.lpr | 9 +++------ .../codetools/examples/scanexamples/addeventexample.pas | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/components/codetools/examples/addeventmethod.lpr b/components/codetools/examples/addeventmethod.lpr index 1c8557c7a8..592bfa4e2e 100644 --- a/components/codetools/examples/addeventmethod.lpr +++ b/components/codetools/examples/addeventmethod.lpr @@ -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); diff --git a/components/codetools/examples/scanexamples/addeventexample.pas b/components/codetools/examples/scanexamples/addeventexample.pas index 6996de3e9d..13fe5897cf 100644 --- a/components/codetools/examples/scanexamples/addeventexample.pas +++ b/components/codetools/examples/scanexamples/addeventexample.pas @@ -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);