DBSRichViewEdit Question(s)

General TRichView support forum. Please post your questions here
Post Reply
CStevenson
Posts: 8
Joined: Sun Apr 05, 2009 12:40 am

DBSRichViewEdit Question(s)

Post by CStevenson »

Is it possible to put a picture placeholder in a RichView document, and then automatically load the picture from a database when the document is viewed? (Ideally, this would ONLY load the picture when it was within the current screen, dynamically loading the pictures as needed.) The goal is to keep the document size extremely small by using the placeholders mentioned above, but still have access to the pictures when needed.

Also, how do I get the text to wrap around a picture? (Like MS Word does....)
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can exclude rvfoSavePicturesBody from RichView.RVFOptions, and use RichView.OnRVFPictureNeeded event to load pictures.

Text wrap around pictures is not implemented yet. Currently I am working on left and right alignment of pictures (like in HTML)
CStevenson
Posts: 8
Joined: Sun Apr 05, 2009 12:40 am

Post by CStevenson »

Sergey Tkachenko wrote:You can exclude rvfoSavePicturesBody from RichView.RVFOptions, and use RichView.OnRVFPictureNeeded event to load pictures.

Text wrap around pictures is not implemented yet. Currently I am working on left and right alignment of pictures (like in HTML)
Thank you. I'll try that. Are there plans to implement text wrap around? If not, I'd like to request this feature.

How do I get the spiral notebook look, like is in the ActionTest demo? I have tried copying it from the document, and pasting it into a DBSRichViewEdit, but I don't get the spiral notebook.

Thanks,
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Left/right alignment of picture means text wrapping around to the right/left of the picture. Text at both left and right sides of picture is not planned for near future.

The notebook effect is implemented using tiled background picture. Background is not copied to the clipboard. You can see this picture in Format | Background menu.
CStevenson
Posts: 8
Joined: Sun Apr 05, 2009 12:40 am

Post by CStevenson »

Sergey Tkachenko wrote:Left/right alignment of picture means text wrapping around to the right/left of the picture. Text at both left and right sides of picture is not planned for near future.

The notebook effect is implemented using tiled background picture. Background is not copied to the clipboard. You can see this picture in Format | Background menu.
I'm trying to get the notebook background to save in a DBSRichViewEdit, but it doesn't seem to save. Is there something special I need to do? (Or would I have to save that separately?)
CStevenson
Posts: 8
Joined: Sun Apr 05, 2009 12:40 am

Post by CStevenson »

Sergey Tkachenko wrote:You can exclude rvfoSavePicturesBody from RichView.RVFOptions, and use RichView.OnRVFPictureNeeded event to load pictures.

Text wrap around pictures is not implemented yet. Currently I am working on left and right alignment of pictures (like in HTML)
I see where (and how) to process the picture loading from RichView.OnRVFPictureNeeded event. However, I am not clear on how to embed the name in the document prior to saving. Do you have some example code of how to do this? (I see the sample code in the helpfile for the OnRVFPictureNeeded event, but I need the other side.)
CStevenson
Posts: 8
Joined: Sun Apr 05, 2009 12:40 am

Post by CStevenson »

I've gotten the following error twice now with DBSRichViewEdit: "A call to an OS function has failed." Any idea what is causing this?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Sorry, such problem was never reported. If you can reproduce it in a simple project, please send it to me.
CStevenson
Posts: 8
Joined: Sun Apr 05, 2009 12:40 am

Post by CStevenson »

Sergey,

I had two other questions earlier in this thread that you didn't answer. Would you look back at them, please?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

For saving and loading background, include rvfoSaveBack and rvfoLoadBack in RVFOptions property.
Assigning BackgroundStyle and BackgroundBitmap properties is not an editing operations, so you need to write some additional code to store them in db (CanChange before assigning, Change after, see http://www.trichview.com/help/idh_examp ... edit1.html )
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can store file name either in item text (the first parameter of InsertPicture) or in rvespImageFileName item property. The latter is recommended.

If you insert pictures yourself, use this code:

Code: Select all

rve.TopLevelEditor.BeginUndoGroup(rvutInsert);
rve.TopLevelEditor.SetUndoGroupMode(True);
if rve.InsertPicture(...) then
  rve.SetCurrentItemExtraStrProperty(rvespImageFileName, FileName, true);
rve.TopLevelEditor.SetUndoGroupMode(False);
But images may appear in the document in a different way, for example when you paste them or insert RTF file.
I suggest, before saving document, to enumerate all pictures and assign FileName to them.
See the demo in Demos\Delphi\Assorted\Graphics\SharedImages\. This demo stores all pictures in a special subfolder. Before saving, it calls SaveAllUnknownImages procedure which assigns names to all pictures with undefined names and saves them to this subfolder.
Post Reply