Stream problems using controls Developer Express Controls

General TRichView support forum. Please post your questions here
Post Reply
Michel

Stream problems using controls Developer Express Controls

Post 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
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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?
mko
Posts: 3
Joined: Thu Sep 01, 2005 12:10 pm

Post 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.
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Controls are loaded using TStream.ReadComponent method. I do not know, may be DevExpress Controls need additional initialization.
Joel Cuyos

Post 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
Post Reply