| Important keys in Delphi
F1: Help
F12: Toggle Form/Unit
Alt F12: Toggle Form/.Dfm
F7: Single Step (Step into Procedures)
F8: Single Step (Step over Procedures)
F9: Run Program
Ctrl F2: Reset (Stop) Program
Enter the code in
Delphi
In Delphi, it is easy to enter code.
This is how you do it: -
1) Click on the component you want
the code for.
2) Flip to the Events page in the Object Inspector.
3) Double-click in the relevant event handler's box.
4) Delphi will put the cursor between the Begin and End lines.
5) Start typing the code.
If you are declaring a variable,
please note that they have to be declared between the 'procedure'
and 'begin' lines..
In your code rememer to (this will
your code easyer to understand later):
Capitalize the first letter of each new word (in a name)
Avoid underscores (I think they are redundant) New_Data should be
NewDat
Indent 2 or 3 spaces
Line up ALL begin ends
Example:
for x:=1 to 22 do
begin
if y>32 then ....
end;
if ... then
begin
...
end
else if ... then
begin
...
end;
It's a lot easier to write
complicated code.
It takes a lot more understanding to simplify the problem down to
it's essence.
One thing to avoid; Do Not get to tricky or compact your code too
much.
Remember you want your code to be easy to read and understand.
Which is easier to read: (A or B?)
| A |
B |
xxxxxxxxxxxxxxxxxx
xxxxxxxxx
xxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxx
xxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxx |
xxxxxxxxxxxxxxxxx
xxxxxx
xxxxxxxxxx
xxxxxxxx
xxxxxxxxxxxx |
B is easier to read (it has more
structure)
You should use blank lines to put your code into functional
blocks.
Tip: Try to use Smart Tab option form the Tools->Editor
Options.
|