Guest
Guest
|
i can connect to word application from AddInModule but i can't connect word application from my form that shown from AddInModule |
|
Dmitry Kostochko
Add-in Express team
Posts: 2887
Joined: 2004-04-05
|
Hi Guest,
Try to pass the TAddInModule instance (Self) in the constructor of your form and use this reference. See the pseudo code below:
implementation
uses Form1;
{ TAddInModule }
procedure TAddInModule.DoShowMyForm(Sender: TObject);
begin
MyForm := TMyForm.Create(Self);
try
MyForm.ShowModal;
finally
FreeAndNil(MyForm);
end;
end;
(*---------------*)
unit Form1;
interface
uses MyAddIn_IMPL;
{ TMyForm }
type
TMyForm = class(TForm)
private
FAddInModule: TAddInModule;
public
constructor Create(AOnwer: TComponent); override;
procedure MyMethod;
end;
constructor TMyForm.Create(AOnwer: TComponent);
begin
inherited Create(AOwner);
if AOwner is TAddInModule then
FAddInModule := TAddInModule(AOwner);
end;
procedure TMyForm.MyMethod;
begin
// TODO
if Assigned(FAddInModule) then
FAddInModule.WordApp. ;
end;
|
|