Microsoft Excel reporting and 
 data analyzing with practically no coding. 
 .Net, ActiveX, and VCL versions. 
 www.AfalinaSoft.com  

Home    Products    Downloads    Registered users    Support    Prices    Order    Primary Subscription

 

MS Office COM Add-ins. Microsoft Excel reporting 
 and data analyzing


TaxpAddin virtual methods - Office Add-in Express Reference

<< Previous

Table of contents

Next >>


TaxpAddin virtual methods


AddIn_Initialize

Provides an opportunity to initialize the add-in.

protected
procedure AddIn_Initialize; virtual;

This method is invoked when the add-in is loaded. You should override this method in the following cases:

  • You need to create your own command bars and/or controls;
  • You need to set any handlers of host application events;
  • You need to get references to interfaces of the host application;
  • You need to customize add-in initialization.

The first action of an overriding method must be to call the inherited method of TaxpAddIn.

Sample code:

procedure TMySecondAddIn.AddIn_Initialize;
var
DM: TDataModule1;
ICBox: IaxpComboBox;
begin
inherited;
DM := TDataModule1.Create(nil);
try
DM.Table1.Active := true;
AddCmdBar(BarName, IsNew);
ICBox := AddComboBox(BarName, 'Coutry:', cbCountryTag,
'Select country', msoComboLabel, true, IsNew);
ICBox.Clear;
while not DM.Table1.EOF do begin
ICBox.AddItem(DM.Table1.FieldByName('Name').AsString,
EmptyParam);
DM.Table1.Next;
end;
finally
DM.Free;
end;
end;

Page Top

AddIn_Finalize

Uninitializes the add-in.

protected
procedure AddIn_Finalize; virtual;

This method is invoked before the add-in is unloaded. You should override this method in the following cases:

  • You need to release references to interfaces of the host application;
  • You need to customize final actions of the add-in.

The last action of the overriding method must be to call the inherited method of TaxpAddIn.

Sample code:

type
TMySecondAddIn = class(TaxpAddIn, IMySecondAddIn)
private
FIHost: tlbExcel._Application;
protected
{ Protected declarations }
procedure AddIn_Initialize; override;
procedure AddIn_Finalize; override;
public
property IHost: tlbExcel._Application read FIHost;
end;

...

procedure TMySecondAddIn.AddIn_Initialize;
var

...

IUnk: IUnknown;
begin
inherited;
IUnk := HostApp;
IUnk.QueryInterface(tlbExcel._Application, FIHost);
end;

procedure TMySecondAddIn.AddIn_Finalize;
begin
FIHost := nil;
inherited;
end;

Page Top

AddIn_ControlEvent

The event handler of the add-in's controls.

protected
procedure AddIn_ControlEvent(const Tag: string;
ICtrl: IaxpControl); virtual;

This method is invoked for any event of the controls that were created in AddIn_Initialize. In fact, there are only two events: Click (CommandBarButton) and Change (CommandBarComboBox). You should override it only if you use AddXXX methods in AddIn_Initialize.

Parameters:

  • Tag - the value of the Tag property of the sender (CommandBarControl.Tag).
  • ICtrl - reference to the interface of the sender (CommandBarControl).

Sample code:

procedure TMySecondAddIn.AddIn_ControlEvent(const Tag: string;
ICtrl: IaxpControl);
begin
if Tag = cbCountryTag then
HostApp.Selection.Value := (ICtrl as IaxpComboBox).Text;
end;

<< Previous

Table of contents

Next >>



Developed for

Delphi 5, 6, 7
Excluding Delphi Personal


[ Download it ]

[ Order now ]

Immediate shipment




ADX Toys™

Free sample
add-ins with a complete source code based on Add-in Express.

[  Read more  ]




We are Borland 
 technology partner


Copyright © 1999-2006
All right reserved.
Privacy Policy

Write to WebMaster

Page Top
Add-in Express - COM Add-ins, Smart Tags and RTDS in C#, VB, C++, J#, and Delphi