To A: You might need to read these too…
-
Object Pascal (Coding) Style Guide (Yes, it's from Delphi, but it should apply to all Object Pascal dialects as well, like Free Pascal.)-
Modern Object Pascal Introduction (Some topics are a bit advance but most of them are very useful informations.)However, like in other languages, the coding style isn't mandatory. I personally don't follow them all. For example, instead of
PascalCase I prefer camelCase. So, I prefer to use
getValue() instead of
GetValue(). As for component naming, I also prefer to use
btnSave (common abbreviation) instead of
ButtonSave (full name). But that's me, you may use whichever style you prefer.
So, my version would be like this:
procedure TForm1.edNameChange(Sender: TObject);
begin
if edName.Text = '' then
btnOK.Enabled := false
else
btnOK.Enabled := true;
end;
or the shorter one…
procedure TForm1.edNameChange(Sender: TObject);
begin
btnOK.Enabled := (edName.Text <> '');
end;