WPCubed Product Support

Content not saved to DB with TDBWPRichText

Hello,
I wanted to use use TDBWPRichText for several simple Text input fields in our program.
I use the Default Editor. The function looks as the following:

void OpenAndEdit(TWPCustomRichText *Source, bool ReadOnly){  WPToolsEditor->WPRichText1->AsString = Source->AsString;  WPToolsEditor->ShowModal();  if(!ReadOnly)    Source->AsString = WPToolsEditor->WPRichText1->AsString;  Source->ReformatAll(true,true);}

The code works fine as the changes I did in the Default Editor appear in the TDBWPRichText. The only Problem is that if I post the table and commit it to the DB nothing appears in the Database and the entries are lost 🙁
If I type something into the Source Editor after editing in the Default Editor and before posting, the changes are saved to the Database. It seems that if I only use the Default Editor TDBWPRichText doesn't recognize that something has changed and doesnt save anything to DB.
Is there any possibility to get arround this? I'd really like to use TDBWPRichText.

I also tried to set

Source->Modified = true;

after Reformating, but that didn't help, too 🙁

Any help is appreciated 🙂

Thanks in advance,
Florian Fanderl

#1 ♥ 0
2.5k Views 2 users read 2 min
support

Hi,

to post to a database do not use a DBWPRichText and assign to it using AsString. Use the field directly, for example
MemoField1.AsString = WPRichText1.AsString;

If you use the default editor to provide a popup editor for your viewer DBWPRichText you need to call
if( Source.Changing() )
{
Source->AsString = WPRichText1.AsString;
}

but I believe an assignmt to zthe field would have the same effect.

Julian

#2 ♥ 0
This category is archived. No new posts are possible.