Page 1 of 1

RVAInsertPicture : Catching image filename?

Posted: Mon Aug 18, 2008 10:20 am
by vega
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

Posted: Mon Aug 18, 2008 6:02 pm
by Sergey Tkachenko
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!)

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;

Posted: Wed Aug 20, 2008 6:46 am
by vega
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;
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?

Accessorily, it would be nice if the 'Object Properties' dialog had an option to put a border around the image.

Thanks, Dan