nicey
asked on
Dynamic Components...
Hello,
I need to create serveral TPanel components during run-time.
I've read up on doing this, and can get the components to create and display, using :
private
ClassRef := TControlClass;
... ...
... ...
procedure TMainForm.setup(Sender: TObject);
var newPanel : TControl;
begin
classRef := TPanel;
newPanel := classRef.Create(self);
newPanel.Visible := false;
newPanel.Parent := theGroupBox;
... ...
-- property setups --
... ...
newPanel.visible := true;
end;
... though, in a loop to create more than one, obviously.
Thing is, for example, the "Color" property isn't accessable for the dynamically created objects.
I can set the "top", "left", "width", "height"... etc. properties, but stuff like the bevel and color settings aren't accessable.
How would I manage to be able to set the new component colours, and stuff?
I need to create serveral TPanel components during run-time.
I've read up on doing this, and can get the components to create and display, using :
private
ClassRef := TControlClass;
... ...
... ...
procedure TMainForm.setup(Sender: TObject);
var newPanel : TControl;
begin
classRef := TPanel;
newPanel := classRef.Create(self);
newPanel.Visible := false;
newPanel.Parent := theGroupBox;
... ...
-- property setups --
... ...
newPanel.visible := true;
end;
... though, in a loop to create more than one, obviously.
Thing is, for example, the "Color" property isn't accessable for the dynamically created objects.
I can set the "top", "left", "width", "height"... etc. properties, but stuff like the bevel and color settings aren't accessable.
How would I manage to be able to set the new component colours, and stuff?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanx ;-)
ASKER
That is very much appreciated. It Works A Treat.
Cheers mate. ;-)