My app has TDBRichView (of course, with database field associated with it). When I load content of RV from file - it showed correctly.
But how I can update database field with this new content? I try this code:
NotesTable->Edit();
DBRichViewEdit->Change();
NotesTable->Post();
But it does not work.
TDBRichView and corresponding database field update
I think you are missing a call to DBRichViewEdit->CanChange(). If performing programmatic edits, you'd want to call:
NotesTable->Edit();
if (!DBRichViewEdit->CanChange())
; // Bail out gracefully
// This is where, I guess, you'd change the contents
DBRichViewEdit->Change();
NotesTable->Post();
If the idea is to simply allow the end-user to edit text interactively, I don't believe you need to call anything. Just treat DBRichViewEdit as you'd treat a TDBEdit or similar.
Good luck!
Michel
NotesTable->Edit();
if (!DBRichViewEdit->CanChange())
; // Bail out gracefully
// This is where, I guess, you'd change the contents
DBRichViewEdit->Change();
NotesTable->Post();
If the idea is to simply allow the end-user to edit text interactively, I don't believe you need to call anything. Just treat DBRichViewEdit as you'd treat a TDBEdit or similar.
Good luck!
Michel
-
- Site Admin
- Posts: 17534
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Actually, DBRichViewEdit->CanChange() calls table->Edit().
Calling CanChange() & Change() is required only if DBRichViewEdit was modified using non-editing methods (such as Load** or Add*** methods).
CanChange() & Change() are not required if the document was modified using editing methods (all methods introduced in TCustomRichViewEdit, marked in the help file as "editing-style methods"), or directly by the user (typing, etc.).
In this case, NotesTable->Post() is enough.
Calling CanChange() & Change() is required only if DBRichViewEdit was modified using non-editing methods (such as Load** or Add*** methods).
CanChange() & Change() are not required if the document was modified using editing methods (all methods introduced in TCustomRichViewEdit, marked in the help file as "editing-style methods"), or directly by the user (typing, etc.).
In this case, NotesTable->Post() is enough.