Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delphi Component: Changing Color on the fly

Status
Not open for further replies.

efabor

Programmer
Feb 6, 2005
2
CA
Hi there;

The purpose is to have a base class from which the objects of my application are derived. I want to whenever I will change the color of the base class, it will afect the objects of my application. The problem is Delphi saves the values of the objects properties in a file .xfm and it will load those defaults values. So, if I have 40 buttons in different forms and I want to change the color of the buttons I have to go manually thru all of them.


I tried to change the color in the constructor of the base class but it didnt work.

This is the base class of Button objects :

TButtonHabab = class(TButton)
public
{ Public declarations }
constructor Create (AOwner: TComponent); override;
procedure TranslateMyCaption();
end;

procedure Register;

implementation

procedure Register;
begin
RegisterComponents('Standard', [TButtonHabab]);
end;


{ TButtonHabab }

constructor TButtonHabab.Create(AOwner: TComponent);
begin
inherited; Create (AOwner);
Color:= clOlive;
end;


end.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top