Subject | Re: [IBO] New Component |
---|---|
Author | Mauricio Longo |
Post date | 2001-01-27T16:06:04Z |
Paul,
This is generally done to allow developers of descendant classes to publish
only the properties and methods they fill appropriate. If you take a look
at the VCL code you'll notice, for example that TPanel is a descendant from
TCustomPanel but that it does not add any new features. It just punlishes
the properties the VCL team though represented the appropriate interface for
that component.
Now, if you need to build a new component that is based on a panel, but you
feel the user should not have access to some panel information, then you
derive your component from TCustomPanel and publish only the properties you
feel the user will need.
To illustrate this I've copied bellow the declaration of the TPanel class.
As you can see, nothing is added, just published. All the actual
functionality is impemented in the "Custom" ancestor.
I hope this helped.
[]s,
Mauricio Longo
TPanel = class(TCustomPanel)
public
property DockManager;
published
property Align;
property Alignment;
property Anchors;
property AutoSize;
property BevelInner;
property BevelOuter;
property BevelWidth;
property BiDiMode;
property BorderWidth;
property BorderStyle;
property Caption;
property Color;
property Constraints;
property Ctl3D;
property UseDockManager default True;
property DockSite;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property FullRepaint;
property Font;
property Locked;
property ParentBiDiMode;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnCanResize;
property OnClick;
property OnConstrainedResize;
property OnContextPopup;
property OnDockDrop;
property OnDockOver;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetSiteInfo;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnStartDock;
property OnStartDrag;
property OnUnDock;
end;
This is generally done to allow developers of descendant classes to publish
only the properties and methods they fill appropriate. If you take a look
at the VCL code you'll notice, for example that TPanel is a descendant from
TCustomPanel but that it does not add any new features. It just punlishes
the properties the VCL team though represented the appropriate interface for
that component.
Now, if you need to build a new component that is based on a panel, but you
feel the user should not have access to some panel information, then you
derive your component from TCustomPanel and publish only the properties you
feel the user will need.
To illustrate this I've copied bellow the declaration of the TPanel class.
As you can see, nothing is added, just published. All the actual
functionality is impemented in the "Custom" ancestor.
I hope this helped.
[]s,
Mauricio Longo
TPanel = class(TCustomPanel)
public
property DockManager;
published
property Align;
property Alignment;
property Anchors;
property AutoSize;
property BevelInner;
property BevelOuter;
property BevelWidth;
property BiDiMode;
property BorderWidth;
property BorderStyle;
property Caption;
property Color;
property Constraints;
property Ctl3D;
property UseDockManager default True;
property DockSite;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property FullRepaint;
property Font;
property Locked;
property ParentBiDiMode;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnCanResize;
property OnClick;
property OnConstrainedResize;
property OnContextPopup;
property OnDockDrop;
property OnDockOver;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetSiteInfo;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnStartDock;
property OnStartDrag;
property OnUnDock;
end;