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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
{
This is still under development!!!!!!!!!!!!!!!!!
}
program calendartest;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes, SysUtils, fpgfx, gui_form, gui_popupcalendar, gui_edit,
gui_button, gui_label, gfx_popupwindow, gui_combobox;
type
TMainForm = class(TfpgForm)
private
procedure btnDownClicked(Sender: TObject);
procedure DoDropDown;
public
{@VFD_HEAD_BEGIN: MainForm}
edtName1: TfpgEdit;
btnName1: TfpgButton;
lblName1: TfpgLabel;
lblName2: TfpgLabel;
cbName1: TfpgComboBox;
{@VFD_HEAD_END: MainForm}
FDropDown: TfpgPopupCalendar;
procedure AfterCreate; override;
end;
{@VFD_NEWFORM_DECL}
{ TMainForm }
procedure TMainForm.btnDownClicked(Sender: TObject);
begin
DoDropDown;
end;
procedure TMainForm.DoDropDown;
begin
if (not Assigned(FDropDown)) or (not FDropDown.HasHandle) then
begin
FDropDown := TfpgPopupCalendar.Create(nil);
FDropDown.ShowAt(self, edtName1.Left, edtName1.Top+edtName1.Height);
FDropDown.PopupFrame:= True;
FDropDown.grdName1.SetFocus;
end
else
begin
FDropDown.Close;
FreeAndNil(FDropDown);
end;
end;
procedure TMainForm.AfterCreate;
begin
inherited AfterCreate;
{@VFD_BODY_BEGIN: MainForm}
Name := 'MainForm';
SetPosition(286, 234, 417, 270);
WindowTitle := 'fpGUI Calendar Test';
WindowPosition := wpUser;
edtName1 := TfpgEdit.Create(self);
with edtName1 do
begin
Name := 'edtName1';
SetPosition(84, 48, 120, 22);
Text := '';
FontDesc := '#Edit1';
end;
btnName1 := TfpgButton.Create(self);
with btnName1 do
begin
Name := 'btnName1';
SetPosition(204, 48, 19, 22);
Text := '';
FontDesc := '#Label1';
ImageName := 'sys.sb.down';
OnClick := @btnDownClicked;
end;
lblName1 := TfpgLabel.Create(self);
with lblName1 do
begin
Name := 'lblName1';
SetPosition(84, 32, 80, 16);
Text := 'Enter a date:';
FontDesc := '#Label1';
end;
lblName2 := TfpgLabel.Create(self);
with lblName2 do
begin
Name := 'lblName2';
SetPosition(68, 116, 276, 16);
Text := '***** This is still Work-In-Progress *****';
FontDesc := '#Label2';
end;
cbName1 := TfpgComboBox.Create(self);
with cbName1 do
begin
Name := 'cbName1';
SetPosition(124, 184, 120, 23);
Items.Add('line1');
Items.Add('line2');
Items.Add('line3');
Items.Add('line4');
Items.Add('line5');
Items.Add('line6');
FontDesc := '#List';
end;
{@VFD_BODY_END: MainForm}
end;
{@VFD_NEWFORM_IMPL}
procedure MainProc;
var
frm: TMainForm;
begin
fpgApplication.Initialize;
frm := TMainForm.Create(nil);
try
frm.Show;
fpgApplication.Run;
finally
frm.Free;
end;
end;
begin
MainProc;
end.
|