Page 1 of 1

Big problem with TRichView and cxGrid

Posted: Fri Oct 12, 2012 4:02 pm
by abranquart
I’m using TRichView inplace editors with cxGrid (Table and BandedTable views) version 2011 vol 2.4.

I have a big problem: All RichView cells are displaying the RTF as plain text !
When I click on one cell to edit it, the RTF is correctly displayed, but when I exit the editor the RTF is displayed again again as plain text.

PLEASE HELP ! Going on production on monday !

PS : RTF Plain text = -8 1 3 1 -7 0 -1 0 0 0 0 536870911 -9 2 0 0 2 0 1 Y ...

Thank you in advance !

Posted: Fri Oct 12, 2012 5:47 pm
by Sergey Tkachenko
As I can see, the edited content is saved as RVF (RichView Format). Then the component cannot load RVF, and it displays it as a plain text.
Probably, this database cannot contain binary data.
You can change saving format to RTF. For this editor, change Properties.EditValueSaveFormat = cxrvvfRTF

Posted: Fri Oct 12, 2012 6:37 pm
by abranquart
Hi Sergey,
Thank you for you prompt reply.

The field is working fine with a TcxDBTRichViewEdit, but when I need to show/edit the same field in a cxGrid I'm getting this strange behavior ... when the field/cell is not in edit mode it displays the RVF as plan text, when the field/cell enter in edit mode (after clicking in the cell) everithing is fine ...

Please, take a look here :
http://screencast.com/t/Xeql4O8mv

Posted: Sun Oct 14, 2012 8:11 am
by Sergey Tkachenko
There is a problem in TcxGrid, when a memo field is used.
When data are read from a database, they are passed to edited cell as AnsiString, to other cells as UnicodeString. TRichView can read RVF from AnsiString, but cannot from UnicodeString. Even a text-mode RVF can contain characters with codes > 127 (for example, non-text item properties are saved in UTF-8), so conversion of RVF from AnsiString to UnicodeString and back may lose information.

Solution: do not use memo fields for RVF format, use binary field.

PS I found my discussion with DevExpress developer about this issue (in December 2011): if a field type is ftMemo, in Delphi 2009+, field data are passed as UnicodeString to inplace editor, and as AnsiString to other cell. It happens for all inplace editor types, not only for TRichView (for example, for their memo fields). Probably, they forgot about this issue :(

Posted: Sun Oct 14, 2012 8:23 am
by Sergey Tkachenko
For any case, try newer version of DX components, probably this question was solved somehow.

Posted: Sun Oct 14, 2012 9:01 am
by abranquart
Hi Sergey,
Unfortunately, I cannot use varbinary fields :-(
You think that if I use RTF format it will resolve the problem ?
Thank you.

Posted: Sun Oct 14, 2012 9:08 am
by abranquart
FYI : I'm not using SaveBinary option

Posted: Sun Oct 14, 2012 1:09 pm
by Sergey Tkachenko
RTF must help, because TRichView can read it both from WideString and AnsiString.
However, not all information can be saved in RTF. For example, label items will be saved as text.