{*******************************************************}
{ }
{ 命令模式的简化 }
{ }
{ 版权所有 (C) 2008 陈新光 }
{ }
{*******************************************************}
...
type
TFormHycx = class(TFormMdi)
private
procedure MenuItemClick(sender:TObject);
end;
...
procedure TFormHycx.FormCreate(Sender: TObject);
var
i:Integer;
begin
inherited;
for i:=0 to PopupMenu.Items.Count-1 do
PopupMenu.Items[i].OnClick:=MenuItemClick;
end;
...
procedure TFormHycx.MenuItemClick(sender: TObject);
begin
case TMenuItem(sender).Tag of
100:ShowGridColEditorA(TDBGridEh(ActiveControl));
101:FindPublicShowA(TDBGridEh(ActiveControl).DataSource.DataSet);
102:ShowFilterFormA(TDBGridEh(ActiveControl).DataSource.DataSet);
103:ShowGroupA(TDBGridEh(ActiveControl));
104:ExpDbgridEhA(TDBGridEh(ActiveControl));
105:PrntA(TDBGridEh(ActiveControl),self);
end;
end;