⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 controllercode.inc

📁 delphi框架
💻 INC
📖 第 1 页 / 共 2 页
字号:
FormViewCreate = 'Application.CreateForm(TView%FormIdent, view)';
NormalViewCreate = 'view := TView%FormIdent.create(nil)';
NormalViewDestory = 'freeAndNil(view)';

ControllerCode =
'unit %ModelIdent;                                                ' + #10#13 +
'                                                                  ' + #10#13 +
'interface                                                         ' + #10#13 +
'uses                                                              ' + #10#13 +
'SysUtils, forms, buttons, classes, controls,patterns,             ' + #10#13 +
'%FormIdentMdl,%FormIdentView;                                     ' + #10#13 +
'                                                                  ' + #10#13 +
'type                                                              ' + #10#13 +
'  TController%FormIdent = class(TController)                      ' + #10#13 +
'    model: TModel%FormIdent;                                      ' + #10#13 +
'    view: TView%FormIdent;                                        ' + #10#13 +
'  protected                                                       ' + #10#13 +
'    Procedure DoCommand(Command: string; const args: string=''''); override; ' + #10#13 +
'  public                                                          ' + #10#13 +
'    Constructor Create;                                           ' + #10#13 +
'    Destructor Destroy; override;                                 ' + #10#13 +
'    Procedure OnClick(Sender: TObject); //for ieventListener      ' + #10#13 +
'    Procedure OnMouseEvent(Sender: TObject;                       ' + #10#13 +
'    Button: TMouseButton; Shift: TShiftState; X, Y: Integer);     ' + #10#13 +
'  end;                                                            ' + #10#13 +
'                                                                  ' + #10#13 +
'implementation                                                    ' + #10#13 +
'                                                                  ' + #10#13 +
'Procedure TController%FormIdent.OnClick(Sender: TObject);         ' + #10#13 +
'begin                                                             ' + #10#13 +
'                                                                  ' + #10#13 +
'end;                                                              ' + #10#13 +
'                                                                  ' + #10#13 +
'Procedure TController%FormIdent.OnMouseEvent(Sender: TObject;     ' + #10#13 +
'Button: TMouseButton; Shift: TShiftState; X, Y: Integer);         ' + #10#13 +
'begin                                                             ' + #10#13 +
'                                                                  ' + #10#13 +
'end;                                                              ' + #10#13 +
'                                                                  ' + #10#13 +
'Constructor TController%FormIdent.Create;                         ' + #10#13 +
'begin                                                             ' + #10#13 +
'  inherited;                                                      ' + #10#13 +
'  model := TModel%FormIdent.Create;                               ' + #10#13 +
'  %ViewCreation;                  ' + #10#13 +
'  model.RegObserver(view);                                        ' + #10#13 +
'end;                                                              ' + #10#13 +
'                                                                  ' + #10#13 +
'Destructor TController%FormIdent.destroy;                         ' + #10#13 +
'begin                                                             ' + #10#13 +
'  freeAndNil(model);                                              ' + #10#13 +
'  %FreeView;                                             ' + #10#13 +
'  inherited;                                                        ' + #10#13 +
'end;                                                              ' + #10#13 +
'                                                                  ' + #10#13 +
'Procedure TController%FormIdent.DoCommand(Command: string; const args: string=''''); ' + #10#13 +
'begin                                                             ' + #10#13 +
'end;                                                              ' + #10#13 +
'                                                                  ' + #10#13 +
'initialization                                                    ' + #10#13 +
'  ControlCenter.RegController(TController%FormIdent.Create);      ' + #10#13 +
'                                                                  ' + #10#13 +
'end.                                                              ' + #10#13;


ControllerCode2 =
'unit %ModelIdent;                                                ' + #10#13 +
'                                                                  ' + #10#13 +
'interface                                                         ' + #10#13 +
'uses                                                              ' + #10#13 +
'SysUtils, forms, buttons, classes, controls,patterns;             ' + #10#13 +
'                                                                  ' + #10#13 +
'type                                                              ' + #10#13 +
'  TController%FormIdent = class(TController)                      ' + #10#13 +
'    model: TModel%FormIdent;                                      ' + #10#13 +
'    view: TView%FormIdent;                                        ' + #10#13 +
'  protected                                                       ' + #10#13 +
'    Procedure DoCommand(Command: string; const args: string=''''); override; ' + #10#13 +
'  public                                                          ' + #10#13 +
'    Constructor Create;                                           ' + #10#13 +
'    Destructor Destroy; override;                                 ' + #10#13 +
'    Procedure OnClick(Sender: TObject); //for ieventListener      ' + #10#13 +
'    Procedure OnMouseEvent(Sender: TObject;                       ' + #10#13 +
'    Button: TMouseButton; Shift: TShiftState; X, Y: Integer);     ' + #10#13 +
'  end;                                                            ' + #10#13 +
'                                                                  ' + #10#13 +
'%ModelDef                                                        ' + #10#13 +
'                                                                  ' + #10#13 +
'%ViewDef                                                          ' + #10#13 +
'implementation                                                    ' + #10#13 +
'                                                                  ' + #10#13 +
'                                                                  ' + #10#13 +
'Procedure TController%FormIdent.onClick(Sender: TObject);         ' + #10#13 +
'begin                                                             ' + #10#13 +
'                                                                  ' + #10#13 +
'end;                                                              ' + #10#13 +
'                                                                  ' + #10#13 +
'Procedure TController%FormIdent.OnMouseEvent(Sender: TObject;     ' + #10#13 +
'Button: TMouseButton; Shift: TShiftState; X, Y: Integer);         ' + #10#13 +
'begin                                                             ' + #10#13 +
'                                                                  ' + #10#13 +
'end;                                                              ' + #10#13 +
'                                                                  ' + #10#13 +
'Constructor TController%FormIdent.Create;                         ' + #10#13 +
'begin                                                             ' + #10#13 +
'  inherited;                                                      ' + #10#13 +
'  model := TModel%FormIdent.Create;                               ' + #10#13 +
'  %ViewCreation;                                                  ' + #10#13 +
'  model.RegObserver(view);                                        ' + #10#13 +
'end;                                                              ' + #10#13 +
'                                                                  ' + #10#13 +
'Destructor TController%FormIdent.destroy;                         ' + #10#13 +
'begin                                                             ' + #10#13 +
'  freeAndNil(model);                                              ' + #10#13 +
'  %FreeView;                                             ' + #10#13 +
'  inherited;                                                        ' + #10#13 +
'end;                                                              ' + #10#13 +
'                                                                  ' + #10#13 +
'Procedure TController%FormIdent.DoCommand(Command: string; const args: string=''''); ' + #10#13 +
'begin                                                             ' + #10#13 +
'end;                                                              ' + #10#13 +
'                                                                  ' + #10#13 +
'%ModelImpl                                                        ' + #10#13 +
'                                                                  ' + #10#13 +
'%ViewImpl                                                         ' + #10#13 +
'initialization                                                    ' + #10#13 +
'  ControlCenter.RegController(TController%FormIdent.Create);      ' + #10#13 +
'                                                                  ' + #10#13 +
'end.                                                              ' + #10#13;



ControllerCodeWithoutModel =
'unit %ModelIdent;                                                ' + #10#13 +
'                                                                  ' + #10#13 +
'interface                                                         ' + #10#13 +
'uses                                                              ' + #10#13 +
'SysUtils, forms, buttons, classes, controls,patterns,             ' + #10#13 +
'%FormIdentView;                                                   ' + #10#13 +
'                                                                  ' + #10#13 +
'type                                                              ' + #10#13 +
'  TController%FormIdent = class(TController)                      ' + #10#13 +
'    view: TView%FormIdent;                                        ' + #10#13 +
'  protected                                                       ' + #10#13 +
'    Procedure DoCommand(Command: string; const args: string=''''); override; ' + #10#13 +
'  public                                                          ' + #10#13 +

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -