I have a form using a TDBRichviewedit. One (and only one) of the dataset records tied to this control contains text using a backgroundimage. That image properly displays when I scroll to that record.
The problem is that the background image remains in place as I scroll to different dataset records that do not have the background image. What is the best way to "clear" this image? Is there an option I'm missing?
Thanks,
Mike Simmons
Persistent background image in TDBRichviewedit
-
- Posts: 29
- Joined: Mon Oct 25, 2010 3:59 pm
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
There are fields formats that can store or cannot store a background image.
Currently, the only format that can store it is RVF (if rvfoSaveBack and rvfoLoadBack are included in DBRichViewEdit.RVFOptions).
For formats that cannot store a background image, it is assumed that an image is the editor decoration, it is displayed for all records. If you want to store it in the record, you need to store it somewhere outside, and assign to BackgroundBitmap in DBRichViewEdit.OnLoadDocument, clear it in DBRichViewEdit.OnNewDocument.
As for RVF that can store an image together with the document, the behavior of TDBRichViewEdit is different in TRichView v13.8 (available for registered users) and older versions of TRichView.
Older versions: do nothing special with the background image, so you need to clear it (assign nil to DBRichViewEdit.BackgroundBitmap) in DBRichViewEdit.OnNewDocument.
New version: clears the bitmap automatically when necessary, no additional code is required.
Note: to assign a background bitmap that will be saved in RVF, you need a code like this:
Currently, the only format that can store it is RVF (if rvfoSaveBack and rvfoLoadBack are included in DBRichViewEdit.RVFOptions).
For formats that cannot store a background image, it is assumed that an image is the editor decoration, it is displayed for all records. If you want to store it in the record, you need to store it somewhere outside, and assign to BackgroundBitmap in DBRichViewEdit.OnLoadDocument, clear it in DBRichViewEdit.OnNewDocument.
As for RVF that can store an image together with the document, the behavior of TDBRichViewEdit is different in TRichView v13.8 (available for registered users) and older versions of TRichView.
Older versions: do nothing special with the background image, so you need to clear it (assign nil to DBRichViewEdit.BackgroundBitmap) in DBRichViewEdit.OnNewDocument.
New version: clears the bitmap automatically when necessary, no additional code is required.
Note: to assign a background bitmap that will be saved in RVF, you need a code like this:
Code: Select all
if DBRichViewEdit1.CanChange then begin
DBRichViewEdit1.BackgroundBitmap := ...
DBRichViewEdit1.Change;
end;
-
- Posts: 29
- Joined: Mon Oct 25, 2010 3:59 pm