Stream problems using controls Developer Express Controls
Posted: Thu Sep 01, 2005 3:16 pm
Hi,
I insert all kind of Developer Express controls in TRichViewEdit. After saving and loading, certain controls are not recreated correctly. I traced it back to InnerEdits in those controls. I had to register classes like TcxCustomDropDownInnerEdit to enable streaming (for example using TcxDateEdit). But still the inner edit is not shown after reloading. Other parts of TcxDateEdit look correct.
Maybe you have an solutions for this problem.
A workaround I used is implementing the onItemAction eventhandler where ControlAction = rvcaAfterRVFLoad, in which I create the control myself, which works:
procedure TfrmRichText.RVEControlAction(Sender: TCustomRichView; ControlAction: TRVControlAction; ItemNo: Integer;
var ctrl: TControl);
var
lOldCtrl: TControl;
begin
if ControlAction = rvcaAfterRVFLoad then
begin
lOldCtrl := Ctrl;
Ctrl := RecreateControl;
TRichView(Sender).RemoveControl(lOldCtrl);
// lOldCtrl.Free; // gives access violations
end;
end;
The trouble is freeing the old control. This gives access violations. So my question is: what should I do with ctrl if I create a new control instead, to prevent memoryleaks.
Thanks
I insert all kind of Developer Express controls in TRichViewEdit. After saving and loading, certain controls are not recreated correctly. I traced it back to InnerEdits in those controls. I had to register classes like TcxCustomDropDownInnerEdit to enable streaming (for example using TcxDateEdit). But still the inner edit is not shown after reloading. Other parts of TcxDateEdit look correct.
Maybe you have an solutions for this problem.
A workaround I used is implementing the onItemAction eventhandler where ControlAction = rvcaAfterRVFLoad, in which I create the control myself, which works:
procedure TfrmRichText.RVEControlAction(Sender: TCustomRichView; ControlAction: TRVControlAction; ItemNo: Integer;
var ctrl: TControl);
var
lOldCtrl: TControl;
begin
if ControlAction = rvcaAfterRVFLoad then
begin
lOldCtrl := Ctrl;
Ctrl := RecreateControl;
TRichView(Sender).RemoveControl(lOldCtrl);
// lOldCtrl.Free; // gives access violations
end;
end;
The trouble is freeing the old control. This gives access violations. So my question is: what should I do with ctrl if I create a new control instead, to prevent memoryleaks.
Thanks