Saving BackgroundStyle
Saving BackgroundStyle
Hello,
Is there any property to set to save the BackgroundStyle using DBRichViewEdit?
The BackgroundBitmap is being saved and loaded, but the Style seems to be always bsCentered.
Regards.
Mauro.
Is there any property to set to save the BackgroundStyle using DBRichViewEdit?
The BackgroundBitmap is being saved and loaded, but the Style seems to be always bsCentered.
Regards.
Mauro.
Hi Mauro,
Sergey will correct me if I'm wrong, but here are my observations that may be of some help.
Before modifying things (not necessarily all things, but at least some, e.g., table/cell format), you should call:
if (!RichViewEdit->CanChange()) return;
Making this function call seems to be absolutely essential. Without it, changes are applied but can't be undone, and they don't put the dataset in editing mode (in my experience).
And after the modifications, you should call:
RichViewEdit->Change();
Hope this helps,
Michel
Sergey will correct me if I'm wrong, but here are my observations that may be of some help.
Before modifying things (not necessarily all things, but at least some, e.g., table/cell format), you should call:
if (!RichViewEdit->CanChange()) return;
Making this function call seems to be absolutely essential. Without it, changes are applied but can't be undone, and they don't put the dataset in editing mode (in my experience).
And after the modifications, you should call:
RichViewEdit->Change();
Hope this helps,
Michel
This is really happening.
Thanks for the tip, I'd not saw this problem.
But the other problem still occurs.
I've observed the following:
If I set the backgroundbitmap/style and after this I edit the text, everithing is saved fine.
If I edit the entire text and after this I set the backgroundbitmap/style, the style is not saved.
As a workaround to this I'm insert via delphi a 'X' at the end of the text and sending a Backspace message, this done I put the focus and, finally, exit the focus from the RVE, so this works (but it's not very beautifull).
Mauro.
Thanks for the tip, I'd not saw this problem.
But the other problem still occurs.
I've observed the following:
If I set the backgroundbitmap/style and after this I edit the text, everithing is saved fine.
If I edit the entire text and after this I set the backgroundbitmap/style, the style is not saved.
As a workaround to this I'm insert via delphi a 'X' at the end of the text and sending a Backspace message, this done I put the focus and, finally, exit the focus from the RVE, so this works (but it's not very beautifull).
Mauro.
Strange indeed. Maybe there's something else that is supposed to be done that neither of us is aware of... The only remaining thought I have is: I believe RVActionTest has the functionality you have trouble with (backgrounds, etc.), albeit not in a DB-aware context. Perhaps reading the relevant portion of the source code would give you some ideas. Good luck!
Michel
Michel
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
The Michel's suggestion is absolutely correct.
Call CanChange before (this will change table to the editing mode), and call Change after (this will inform table that RichViewEdit was modified).
All these operations are required only when you modify documents by non-editing methods (including changing BackgroundBitmap and BackgroundStyle properties).
Mauro, what did you mean by "edit the entire text"?
Call CanChange before (this will change table to the editing mode), and call Change after (this will inform table that RichViewEdit was modified).
All these operations are required only when you modify documents by non-editing methods (including changing BackgroundBitmap and BackgroundStyle properties).
Mauro, what did you mean by "edit the entire text"?
When I saw "edit the entire text and after this set background" I mean that the last thing that is done is to set the background. I've saw this to explain that if I make any modification to the text after seting BackgroupBitmap/BackgroundStyle, then everything works fine.
Due to this I've inserted the following code before posting the record.
where dbrveModelo is TDBRichViewEdit and dbeNome is TDBEdit.[/code]
Due to this I've inserted the following code before posting the record.
Code: Select all
if trim(GetAllText(dbrveModelo)) <> '' then
begin
LockWindowUpdate(Handle);
ItemNo := dbrveModelo.ItemCount-1;
Offs := dbrveModelo.GetOffsAfterItem(ItemNo);
dbrveModelo.SetSelectionBounds(ItemNo,Offs,ItemNo,Offs);
dbrveModelo.InsertText('X');
dbrveModelo.Perform(WM_KEYDOWN, VK_BACK,1);
dbrveModelo.SetFocus;
dbeNome.SetFocus;
dbrveModelo.Invalidate;
LockWindowUpdate(0);
end;
I've now used the .CanChange and .Change; "alone" they don't work as expected (ClientDataSet has still .Modified = False and .ChangeCount = 0), but using this and keeping
in the beforepost solved my problem.
Code: Select all
if trim(GetAllText(dbrveModelo)) <> '' then
begin
rv.SetFocus;
dbEdit.SetFocus;
end;
-
- Site Admin
- Posts: 17566
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Not at all. However, if I were you, I'd investigate this much further: what's happening is not normal, so you don't know what else may be going wrong "in the background". Maybe you're missing a call to Format() or something as simple as that somewhere. Or try doing something completely different (but "ideologically similar") instead of playing with the background. Basically, try varying everything you can until something gives you a clue.
Good luck once again!
Michel
Good luck once again!
Michel