Page 1 of 1

Stream problems using controls Developer Express Controls

Posted: Thu Sep 01, 2005 3:16 pm
by Michel
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

Posted: Thu Sep 01, 2005 4:26 pm
by Sergey Tkachenko
Hmm, it should be safe to free the old control here.
Calling TRichView(Sender).RemoveControl(lOldCtrl) is not needed. What if you remove it?

Posted: Mon Sep 05, 2005 6:51 am
by mko
Removing TRichView(Sender).RemoveControl(lOldCtrl); did not help, I added it as a possible solution.

It seems that the reconstruction of the specific controls isn't done correctly when loading RVF into a RichViewEdit, leading to Access Violations when trying to free them.

Posted: Mon Sep 05, 2005 11:45 am
by Sergey Tkachenko
Controls are loaded using TStream.ReadComponent method. I do not know, may be DevExpress Controls need additional initialization.

Posted: Fri Sep 16, 2005 3:39 am
by Joel Cuyos
Hi Sergey,

I also encoutered this problem, and so far doesn't have a workaround for it.

The control that I am having problem with is TInkCollector. It is an ActiveX control from Microsoft for Inking.

I imported it to Delphi using Import Type Library.

Kind regards,
Joel