I've derived a class from TLMDStringsPropEditor to allow me to override the Edit function so I can edit a RichEdit field.But on calling SetObjectValue I get a Delphi exception 'RichEdit line insertion error'.
If I just do a simple Get and Set (with no editing) the richtext value is removed:
void __fastcall TnRichEditPropEditor::Edit()
{
try
{
TStrings * psl = (TStrings *)(GetObjectValue(0));
if(!psl)
throw Exception(String(__FUNC__)+String().sprintf(" !psl"));
SetObjectValue(psl);
}
catch(Exception & e)
{
LOGEXCP(e);
}
}
The exception is thrown from ComCtrls.pas: TRichEditStrings.Insert line 11558:
if RichEdit.SelStart <> (Selection.cpMax + Length(Str)) then
raise EOutOfResources.Create(sRichEditInsertError);
Question: what is the correct way to provide a RichEdit property editor?
Comments