If I trace my application here is what I get (WPIOReadRTF.pas):
In the TWPRTFReader.CloseDestination method FPictureName is assigned properly:
FPictureName := FCurrentExString.GetString;
But then the TWPRTFReader.ChangeDestination (called from TWPRTFReader.Parse) method gets called which erases the FPictureName (I don't know why your are doing this):
Then the TWPRTFReader.CloseDestination method gets called again with the following code:
txtobj := PrintTextObj(wpobjImage, FPictureName, '', false, false, false);
But FPictureName was erased just before in the TWPRTFReader.ChangeDestination method.
Here are the exact steps to reproduce this problem:
1- Create an image with WPRichText1.TextObjects.Insert(_img, _320, 200, 'BUG_IMAGE');
var
_obj: TWPTextObj;
_img: TWPOImage;
_picture: TPicture;
begin
...
_img := TWPOImage.Create(f_WPRichText);
_img.AssignBitmap(_picture.Graphic);
_obj := f_WPRichText.TextObjects.Insert(_img, 320, 200, 'BUG_IMAGE');
...
end;
Alles anzeigen
2- Save your RTF document. (Note that in my application I use another extension than RTF. I also tried this with the RTF file extension and I still have the problem)
3- Clear your RTF document.
4- Load your saved RTF document. TWPRTFReader.ChangeDestination method gets called and erases FPictureName (this is the actual bug I think).
5- Create an OnTextObjectDblClick event with some code and put a break point.
6- Double-click on your image and you should be in your breakpoint in the OnTextObjectDblClick event.
7- Inspect the parameter pobj.Name (TWPTextObj). You will see that it is empty.
Please try to duplicate this bug and then tell me how I can make this work.
Thanks
Michel