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
|
unit frm_menutest;
{$mode objfpc}{$H+}
interface
uses
SysUtils, Classes, gfxbase, fpgfx, gui_edit,
gfx_widget, gui_form, gui_label, gui_button,
gui_listbox, gui_memo, gui_combobox, gui_grid,
gui_dialogs, gui_checkbox, gui_tree, gui_trackbar,
gui_progressbar, gui_radiobutton, gui_tab, gui_menu;
type
TfrmMain = class(TfpgForm)
private
procedure miExitClicked(Sender: TObject);
public
{@VFD_HEAD_BEGIN: frmMain}
MainMenu: TfpgMenuBar;
miFile: TfpgPopupMenu;
btnName1: TfpgButton;
{@VFD_HEAD_END: frmMain}
procedure AfterCreate; override;
end;
{@VFD_NEWFORM_DECL}
implementation
{@VFD_NEWFORM_IMPL}
procedure TfrmMain.miExitClicked(Sender: TObject);
begin
Close;
end;
procedure TfrmMain.AfterCreate;
begin
{@VFD_BODY_BEGIN: frmMain}
Name := 'frmMain';
SetPosition(278, 186, 399, 142);
WindowTitle := 'frmMain';
WindowPosition := wpScreenCenter;
MainMenu := TfpgMenuBar.Create(self);
with MainMenu do
begin
Name := 'MainMenu';
SetPosition(0, 0, 400, 23);
Anchors := [anLeft,anRight,anTop];
end;
miFile := TfpgPopupMenu.Create(self);
with miFile do
begin
Name := 'miFile';
SetPosition(200, 48, 152, 24);
AddMenuItem('&New...', 'Ctrl-N', nil);
AddMenuItem('&Open...', 'Ctrl-O', nil);
AddMenuItem('-', '', nil);
AddMenuItem('E&xit', 'Alt+F4', @miExitClicked);
end;
btnName1 := TfpgButton.Create(self);
with btnName1 do
begin
Name := 'btnName1';
SetPosition(8, 112, 75, 24);
Text := 'Button';
FontDesc := '#Label1';
ImageName := 'stdimg.quit';
ModalResult := 0;
ShowImage := True;
OnClick := @miExitClicked;
end;
{@VFD_BODY_END: frmMain}
MainMenu.AddMenuItem('&File', nil).SubMenu := miFile;
end;
end.
|