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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a TEdit descendant

Status
Not open for further replies.

carlosonline

Programmer
Dec 23, 2002
1
BR
Hi, everyone!!
I need your help!

I am trying to create a component that would be a TEdit descendant and whose OnEnter event the component changes its color to yellow, for example.
I already know how to create the skeleton of the component but I don't know how to implement this function the makes the component chages its color.
I know that it would be something like this:

TColorEdit(Self).Color := clYellow;

Where TColorEdit is the Edit descendant of TEdit that I am trying to create...
The only problem is that I don't know how to put this to work!!!
Please, help me!!!
Any help is welcome!!!

Thanks,
Carlos
carlos_online@ig.com.br
 
There is a lot of information on creating custom components out there. I haven't ever made one myself, but I think you would have to do something like this:

interface
TColorEdit = class(TEdit)
private
procedure DoEnter; override;
end;

implementation
procedure TColorEdit.DoExit;
begin
inherited DoEnter;
Color:=clYellow;
end;


You also have to register the components. I haven't done this before.
procedure Register;
begin
RegisterComponents('MyNewComponents',[TColorEdit]);
end; "The difference between practice and theory is that in theory, there is no difference between practice and theory" - Somebody's tag line I stole
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top