unit Unit1 interface uses Windows Messages SysUtils Variants Classes G

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TMR = record
P1: string;
P2: string;
P3: string;
P4: string;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure MyProc(AA: TMR);
type
TMyRec = record
P1: string;
P2: string;
P3: string;
P4: string;
end;
var
AAA: TMyRec;
begin
AAA.P1 := '1';
AAA.P2 := '2';
AAA.P3 := '3';
AAA.P4 := '4';
if AA.P1 <> '' then AAA.P1 := AA.P1;
if AA.P2 <> '' then AAA.P2 := AA.P2;
if AA.P3 <> '' then AAA.P3 := AA.P3;
if AA.P4 <> '' then AAA.P4 := AA.P4;
ShowMessage(AAA.P1 + ' ' + AAA.P2 + ' ' + AAA.P3 + ' ' + AAA.P4);
end;
procedure TForm1.FormCreate(Sender: TObject);
var
A: TMR;
begin
MyProc(A);
A.P1 := '10';
MyProc(A);
A.P2 := 'q';
A.P4 := 'w';
MyProc(A);
end;
end.