Take a look at this little snip:
implementation
{$R *.dfm}
Do I put my code above {$R *.dfm}
or below it? Does it matter?
I can't find any confirmation on this question.
Is there a set standard on which to go about this or is it just up the designer?
it does not matter but as a rule I put my code below, that compile switch actually links that pas file with a dfm file (pas+dfm = form!), here are some tips.
unit Unit1;
interface
uses
....
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
local_var: String;
function myFormFunction:String;
end;
var
Form1: TForm1;
// global vars
superVar: integer;
const
// global constants
MY_CONST = 'TEXT!!!';
implementation
{$R *.dfm}
{ TForm1 }
// YOUR CODE!
procedure aCoolFunction;
Begin
// your code
inc(superVar);
End;
function TForm1.myFormFunction: String;
begin
// your code
local_var := 'some '+ MY_CONST;
inc(superVar);
end;
end.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With