📄 mainctrl.pas
字号:
unit MainCtrl;
interface
uses
SysUtils, forms, buttons, classes, menus, controls, patterns,
MainMdl, MainView;
type
TControllerMain = class(TController)
model: TModelMain;
view: TViewMain;
protected
procedure DoCommand(Command: string; const args: string = ''); override;
public
constructor Create;
destructor Destroy; override;
procedure OnClick(Sender: TObject); //for ieventListener
procedure OnMouseEvent(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
end;
implementation
uses
commandlist;
procedure TControllerMain.OnClick(Sender: TObject);
begin
if not assigned(sender) then exit;
if (sender is Tmenuitem) then
begin
if (TMenuItem(Sender).caption = '&About...') then
self.sendCommand(CMD_SHOW_ABOUT)
else if (TMenuItem(Sender).caption = '&Help') then
application.MessageBox('Help menu selected!', 'Help', 0);
end;
end;
procedure TControllerMain.OnMouseEvent(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
end;
constructor TControllerMain.Create;
begin
inherited;
model := TModelMain.Create;
Application.CreateForm(TViewMain, view);
view.setNotifyEventHandler(self.onClick);
model.RegObserver(view);
end;
destructor TControllerMain.destroy;
begin
freeAndNil(model);
inherited;
end;
procedure TControllerMain.DoCommand(Command: string; const args: string = '');
begin
end;
initialization
ControlCenter.RegController(TControllerMain.Create);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -