mainview.pas

来自「Delphi利用MVC开发的典型例子」· PAS 代码 · 共 55 行

PAS
55
字号
unit MainView;

// This code was generated by the EasyMVC OTA Wizard
// www.eazisoft.com

interface
uses
  Windows, Messages, SysUtils, Classes, Graphics,
  Controls, StdCtrls, ComCtrls, ExtCtrls, Forms, patterns, Menus;

type
  TViewMain = class(TFORM, IObserver)
    MainMenu1: TMainMenu;
    File1: TMenuItem;
    mnuExit: TMenuItem;
    Help1: TMenuItem;
    mnuAbout: TMenuItem;
    mnuHelp: TMenuItem;
    procedure mnuExitClick(Sender: TObject);
  private
    { Private declarations }
    procedure UpdateView(o: TObject); //from IObserver
  public
    { Public declarations }
    procedure setNotifyEventHandler(ANotifyEvent: TNotifyEvent);
  end;


implementation

{$R *.dfm}

procedure TViewMain.UpdateView(o: TObject);
begin
  {write your code here}
end;

procedure TViewMain.mnuExitClick(Sender: TObject);
begin
  close;
  //it's no neccessary to ask the Controller determine everything
end;

procedure TViewMain.setNotifyEventHandler(ANotifyEvent: TNotifyEvent);
begin
  if assigned(ANotifyEvent) then
  begin
    mnuHelp.OnClick := ANotifyEvent;
    mnuAbout.OnClick := ANotifyEvent;
  end;
end;

end.

 

⌨️ 快捷键说明

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