verpies
asked on
Children of a descendant of TRadioGroup disappearing from DFM after Save
I have created the component TRadioGroupEx ( a descendant of TCustomRadioGroup) with ControlStyle that includes csAcceptsControls in order for it to accept children components during design time. See the code below.
Indeed it is possible to drop children components inside TRadioGroupEx in the FormDesigner IDE during the design time.
However when a simple project with TCheckBox'es inside TRadioGroupEx is saved, closed and reopened, then the children of TRadioGroupEx are missing from the DFM file. Also the checkbox does not appear inside the TRadioGroupEx after building and running the project.
Why do the children disappear from the DFM file?
P.S.
Note that TCheckBox and TRadioGroupEx are both descendants of TWinControl.
When the same TCheckBox is dropped on a TGroupBox instead, then it appears during run time and does not disappear from the DFM file.
Using Delphi7 Pro.
Indeed it is possible to drop children components inside TRadioGroupEx in the FormDesigner IDE during the design time.
However when a simple project with TCheckBox'es inside TRadioGroupEx is saved, closed and reopened, then the children of TRadioGroupEx are missing from the DFM file. Also the checkbox does not appear inside the TRadioGroupEx after building and running the project.
Why do the children disappear from the DFM file?
P.S.
Note that TCheckBox and TRadioGroupEx are both descendants of TWinControl.
When the same TCheckBox is dropped on a TGroupBox instead, then it appears during run time and does not disappear from the DFM file.
Using Delphi7 Pro.
unit RadioGroupEx;
interface
uses
Classes, Controls, ExtCtrls;
type
TRadioGroupEx = class(TCustomRadioGroup)
public
constructor Create(AOwner: TComponent); override;
published
property Align;
property Anchors;
property BiDiMode;
property Caption;
property Color;
property Columns;
property Ctl3D;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Font;
property ItemIndex;
property Items;
property Constraints;
property ParentBiDiMode;
property ParentBackground default True;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnClick;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnStartDock;
property OnStartDrag;
end;
procedure Register;
implementation
constructor TRadioGroupEx.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
ControlStyle := ControlStyle + [csAcceptsControls];
end;
procedure Register;
begin
RegisterComponents('Additional', [TRadioGroupEx]);
end;
end.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
https://www.experts-exchange.com/questions/27491098/Children-of-a-descendant-of-TRadioGroup-not-appearing-at-run-time.html