type
//Event for importcmd inicialization to change atributes
TEventTarget=class(TObject)
public
procedure pOnInitDialog(Sender: TObject; var pMyInterface: OleVariant);
end;
function ImportWDoc()
var
oObject : TEventTarget;
begin
//Import configuration
pContextItems := TContextItems.Create(nil);
pContextItems.Add('IManDestinationObject' , vIManSubFolder );
pContextItems.Add('IManExt.Import.FileName' , plcArquivo );
pContextItems.Add('IManExt.Import.DocAuthor' , cUsuario );
pContextItems.Add('IManExt.NewProfile.ProfileNoUI', True {No Screen} );
//Prepare the event of inicialization to update the atributes/fields of importation
oObject := TEventTarget.Create();
//Comand of doc Importation
pImportCmd := TImportCmd.Create(nil);
pImportCmd.OnInitDialog := oObjeto.pOnInitDialog; //Event of inicialization
pImportCmd.Initialize(pContextItems.DefaultInterface);
pImportCmd.Update;
pImportCmd.Execute;
//Get Doc link in Worksite
If pContextItems.Item('IManExt.Refresh') then begin
vNRTDocument := pContextItems.Item('ImportedDocument');
cObjectID := vNRTDocument.ID;
cDescription := ReplaceSTR(vNRTDocument.Description);
cExtension := vNRTDocument.Extension;
nDocs := vNRTDocument.Number;
Result := cObjectID+' '+IntToStr(nDocs)+' '+cExtension+' '+cDescription;
End{If};
end;
procedure TEventTarget.pOnInitDialog(Sender: TObject; var pMyInterface: OleVariant);
begin
pMyInterface.SetAttributeValueByID(nrComment, 'This work fine in Delphi!!!', True);
end;
Holp this help!
Antonio C Ferreira
TOTVS S/A