📄 spfrm.pas
字号:
unit SpFrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolWin, Grids, DBGridEh;
type
TfrmSp = class(TForm)
CoolBar1: TCoolBar;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
StatusBar1: TStatusBar;
grdSp: TDBGridEh;
procedure ShowSpAdd(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmSp: TfrmSp;
implementation
uses MainDM, SpAddFrm;
{$R *.dfm}
procedure TfrmSp.ShowSpAdd(Sender: TObject);
begin
if dmMain.tblSpSell.CanModify then
begin
dmMain.tblSpSell.Append;
frmSpAdd := TfrmSpAdd.Create(Self);
if frmSpAdd.ShowModal = mrOK then
dmMain.tblSpSell.Post
else
dmMain.tblSpSell.Cancel;
end;
end;
procedure TfrmSp.ToolButton2Click(Sender: TObject);
begin
if dmMain.tblSpSell.RecordCount > 0 then
if MessageDlg('确实要删除该商品吗?', mtWarning,
[mbYes, mbNo], 0) = mrYes then
grdSp.DataSource.DataSet.Delete;
end;
procedure TfrmSp.ToolButton3Click(Sender: TObject);
begin
if dmMain.tblSpSell.CanModify then
begin
dmMain.tblSpSell.Edit;
frmSpAdd := TfrmSpAdd.Create(Self);
frmSpAdd.Caption := '修改商品信息';
if frmSpAdd.ShowModal = mrOK then
dmMain.tblSpSell.Post
else
dmMain.tblSpSell.Cancel;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -