mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-09 07:01:04 +01:00
codetools: fixed example addeventmethod
git-svn-id: trunk@42861 -
This commit is contained in:
parent
71ce8192f2
commit
012a67a370
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user