|
|
|||
Home Products Downloads Registered users Support Prices Order Primary Subscription |
|
||
TaxpAddin virtual methodsAddIn_InitializeProvides 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:
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;
begin
ICBox: IaxpComboBox;
inherited;
end;
DM := TDataModule1.Create(nil); try
DM.Table1.Active := true;
finally
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,
end;
EmptyParam);
DM.Table1.Next;
DM.Free;
end;
AddIn_FinalizeUninitializes 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:
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 }
public
procedure AddIn_Initialize; override; procedure AddIn_Finalize; override;
property IHost: tlbExcel._Application read FIHost;
end;
... procedure TMySecondAddIn.AddIn_Initialize; var ... IUnk: IUnknown;
inherited;
end;IUnk := HostApp; IUnk.QueryInterface(tlbExcel._Application, FIHost); procedure TMySecondAddIn.AddIn_Finalize; begin
FIHost := nil;
end;
inherited; AddIn_ControlEventThe 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:
Sample code:
procedure TMySecondAddIn.AddIn_ControlEvent(const Tag: string;
ICtrl: IaxpControl);
begin
if Tag = cbCountryTag then
end;
HostApp.Selection.Value := (ICtrl as IaxpComboBox).Text;
|
Developed forDelphi 5, 6, 7
[ Download it ] Immediate shipment
|