Before beginning presenting you the basic
components of Delphi and how to work with them, you
must know:
What is an OBJECT
(Component)…
Remember a Component is an Object on
your Palette, and an Object, can be a Component on your Palette, or
something that is created totally in code.
So an OBJECT is a more general class of things, than a
COMPONENT.
All Components are Objects, but not All Objects are Components
(TStringList is an Object, and Not a Component)
What is a
PROPERTY?
A Property is a Variable (e.g. word,
string,...) that has some built-in Methods (functions) to Read and
Write to it's Variable.
What is a METHOD
A Method is a function that is
attached to an Object. For Example:
A ListBox (which can hold an array of strings) has a Method
(Clear) that makes all the strings ='' in the ListBox. Clear is a
Method of the ListBox.
Example:
begin
ListBox1.Clear; // Clears the ListBox
end;
Also, some Properties of a Component
can have their own Methods (e.g. Items, is a Property of
ListBox):
Items, is of type TStrings
TStrings, has a Method 'LoadFromFile' that Opens, Reads and Closes
a File
ListBox1.Items.LoadFromFile
('c:\Data1.txt');
What is an EVENT
An Event is a User Action (Mouse
Click, KeyPressed,...). Events all begin with the word
'On'
OnClick.. Button1Click (Sender
: TObject)
OnKeyDown .. Button1KeyDown (Sender : TObject)
OnMouseMove .. Button1MouseMove (Sender : TObject)
Events are where you write your
Delphi code.
|