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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
{
A simple form with a memo to display text. Handle for debuging etc.
}
unit frm_text;
{$mode objfpc}{$H+}
interface
uses
SysUtils, Classes, fpg_base, fpg_main, fpg_form, fpg_button, fpg_memo;
type
TTextForm = class(TfpgForm)
private
{@VFD_HEAD_BEGIN: TextForm}
btnClose: TfpgButton;
Memo1: TfpgMemo;
btnCopy: TfpgButton;
{@VFD_HEAD_END: TextForm}
procedure btnCopyClicked(Sender: TObject);
public
procedure AfterCreate; override;
end;
{@VFD_NEWFORM_DECL}
procedure ShowText(const ATitle: TfpgString; const AText: TfpgString);
implementation
procedure ShowText(const ATitle: TfpgString; const AText: TfpgString);
var
frm: TTextForm;
begin
frm := TTextForm.Create(nil);
try
if ATitle = '' then
frm.WindowTitle := 'Text Form'
else
frm.WindowTitle := ATitle;
frm.Memo1.Lines.Text := AText;
frm.ShowModal;
finally
frm.Free;
end;
end;
{@VFD_NEWFORM_IMPL}
procedure TTextForm.btnCopyClicked(Sender: TObject);
begin
fpgClipboard.Text := Memo1.Lines.Text;
end;
procedure TTextForm.AfterCreate;
begin
{%region 'Auto-generated GUI code' -fold}
{@VFD_BODY_BEGIN: TextForm}
Name := 'TextForm';
SetPosition(405, 197, 496, 297);
WindowTitle := 'Text Form';
Hint := '';
WindowPosition := wpScreenCenter;
btnClose := TfpgButton.Create(self);
with btnClose do
begin
Name := 'btnClose';
SetPosition(412, 268, 80, 24);
Anchors := [anRight,anBottom];
Text := 'Close';
FontDesc := '#Label1';
Hint := '';
ImageName := '';
ModalResult := mrOK;
TabOrder := 1;
end;
Memo1 := TfpgMemo.Create(self);
with Memo1 do
begin
Name := 'Memo1';
SetPosition(0, 0, 496, 260);
Anchors := [anLeft,anRight,anTop,anBottom];
FontDesc := '#Edit2';
Hint := '';
TabOrder := 2;
end;
btnCopy := TfpgButton.Create(self);
with btnCopy do
begin
Name := 'btnCopy';
SetPosition(4, 268, 128, 24);
Anchors := [anLeft,anBottom];
Text := 'Copy to Clipboard';
FontDesc := '#Label1';
Hint := '';
ImageName := '';
TabOrder := 3;
OnClick := @btnCopyClicked;
end;
{@VFD_BODY_END: TextForm}
{%endregion}
end;
end.
|