Application of Parent attribute. People often overlook the existence of the Parent attribute. Then let him show off his power.
Check out this good stuff:
unit Edit1;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, StdCtrls;
type
TSParent = class(TEdit)
PRivate
{Private declarations}
protected
{ Protected declarations }
public
{Public declarations}
published
{ Published declarations }
property Parent;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TSParent]);
end;
end.
Install this control. Create a new project.
Drag a TSParent control on the Samples page. Would you say this is not a TEdit control?
If you look again, it has an additional Parent attribute. This is amazing, its container can be customized at will during the design, and it can be used as a container regardless of whether other controls have container attributes or not. TPanel, TEdit, TMemo is like a devil that exists everywhere.
This control has two disadvantages. 1) Form cannot be listed in the Parent attribute list. Why? Think about it yourself. 2) The Parent property list can actually list its own controls.
But it's easy to solve it. Just make a property editor yourself.