📄 mainctrl.pas
字号:
unit MainCtrl;
interface
uses
SysUtils, windows, forms, buttons, classes, Menus, controls, patterns,
MainView, toolbox, commandlist;
type
TControllerMain = class(TController)
view: TViewMain;
protected
procedure DoCommand(Command: string; const args: string=''); override;
public
constructor Create;
procedure OnClick(Sender: TObject); //for ieventListener
procedure OnMouseEvent(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
end;
implementation
procedure TControllerMain.OnClick(Sender: TObject);
begin
if (Sender is TMenuItem) then
begin
if TMenuItem(Sender).Caption = CMD_FILE_EXIT then
view.Close
else if TMenuItem(Sender).Caption = CMD_SHOW_HELP then
Application.HelpCommand(HELP_CONTENTS, 0)
else
self.SendCommand(TMenuItem(Sender).Caption);
end
else if (Sender is TSpeedButton) then
begin
if TSpeedButton(Sender).Caption = CMD_BTN_CLOSE then
view.Close
else if TSpeedButton(Sender).Caption = CMD_BTN_HELP then
Application.HelpCommand(HELP_CONTENTS, 0)
else
self.SendCommand(TSpeedButton(Sender).Caption);
end;
end;
procedure TControllerMain.OnMouseEvent(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
end;
constructor TControllerMain.Create;
begin
inherited;
Application.CreateForm(TViewMain, view);
view.setEventListener(self.OnClick);
end;
procedure TControllerMain.DoCommand(Command: string; const args: string='');
begin
if Command = CMD_SYSTEM_START then
view.Show;
end;
initialization
ControlCenter.RegController(TControllerMain.Create);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -