When an image is added to RVE through RVAInsertPicture, I need to copy this image file to another folder and replace the original location with the new location.
The question is : How do I collect the image path and name immediately after the RVA ImageOpen dialog closes?
Thanks, Dan
RVAInsertPicture : Catching image filename?
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Unfortunately, there is no event for this.
But you can use OnExecute event of this action:
This code displays file name of the inserted picture, if rvActionInsertPicture1.StoreFileName=True (not a default value!)
But you can use OnExecute event of this action:
This code displays file name of the inserted picture, if rvActionInsertPicture1.StoreFileName=True (not a default value!)
Code: Select all
procedure TrvActionsResource.rvActionInsertPicture1Execute(
Sender: TObject);
var Item: TCustomRVItemInfo;
FileName: String;
begin
Item := RichViewEdit1.GetCurrentItem;
rvActionInsertPicture1.OnExecute := nil;
rvActionInsertPicture1.Execute;
rvActionInsertPicture1.OnExecute := rvActionInsertPicture1Execute;
if Item<>RichViewEdit1.GetCurrentItem then begin
RichViewEdit1.GetCurrentItemExtraStrProperty(rvespImageFileName, FileName);
Application.MessageBox(PChar(FileName), 'File Name', 0);
end;
end;
Thanks Sergey, it works fine but the problem is that this procedure is not called when user right-clicks the RVE and changes the picture through the 'Object Properties' popup menu option. Any way around this?Sergey Tkachenko wrote:Code: Select all
procedure TrvActionsResource.rvActionInsertPicture1Execute( Sender: TObject); var Item: TCustomRVItemInfo; FileName: String; begin Item := RichViewEdit1.GetCurrentItem; rvActionInsertPicture1.OnExecute := nil; rvActionInsertPicture1.Execute; rvActionInsertPicture1.OnExecute := rvActionInsertPicture1Execute; if Item<>RichViewEdit1.GetCurrentItem then begin RichViewEdit1.GetCurrentItemExtraStrProperty(rvespImageFileName, FileName); Application.MessageBox(PChar(FileName), 'File Name', 0); end; end;
Accessorily, it would be nice if the 'Object Properties' dialog had an option to put a border around the image.
Thanks, Dan