What's the equivalent to WP4's OnTextObjectLoadStreamEvent?

  • We use linked images, but I'm having a bit of trouble reloading the image when the WPRichText is reloaded.

    I was thinking that the OnTextObjectPaint was the replacement for OnTextObjectLoadStreamEvent, and sure enough it seems to be it, however, the image doesn't seem to honor the widthTW and heightTW that it was originally saved as.

    So perhaps TextObjectPaint is not the equivalent method to restore the link image.

    Note: I have another post in the WP5 support forum indicating a problem saving text having linked images to a database... seems the text has some binary values in it (even though it is only a link) that might be causing a problem with the .AsString assignment to the memo data, cutting off part of the link and anything that came after the link. So this test above is from reloading the WPRichText from a file which has the link and everything after it fully intact.

    Thanks,
    Eric

  • Hmmm...

    I perform the following in the TextObjectPaint event, only because this is what seems to show the linked image.

    But once I do this, and then save the RichText again, the entire image is saved into the blob field instead of just the link. How can I show the linked image without causing this behaviour?

    Thanks.

  • Ok.. I changed

    Code
    pobj.LoadFromFile( iName );

    To

    Code
    if pobj.ObjRef.Graphic = nil then
              pobj.ObjRef.LoadFromFile( iName );
            toCanvas.StretchDraw( Rect( X, Y, X+W, Y+H ), pobj.ObjRef.Graphic );

    Which seems to do it and retain the link and the size... but I'm thinking that maybe there's another way.

    • Offizieller Beitrag

    Hi,

    using the TextObjectPaint event is a good idea if you want to delay the loading of the image until the image is displayed. This way the file will load much faster.

    The link to the image can be stored in TWPTextObj.Source. Maybe the load&save routine needs some tweaking to avoid the saving of the binary data. I strongly recommend to check out the source in reader/writer and are open for any suggestion to improve the concept for real workd use. From the technology point of view everything is possible.

    Julian