pubbillfm.pas
来自「一个电力企业的后台管理程序」· PAS 代码 · 共 293 行
PAS
293 行
unit pubBillFM;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Grids, DBGrids, ExtCtrls, ComCtrls, RXDBCtrl, Menus,
ToolWin, ActnList, wenActionPass, ImgList, TB97Tlbr, TB97Ctls, TB97;
type
Tfrm_pubBill = class(TForm)
stb_Main: TStatusBar;
pm_Main: TPopupMenu;
pmi_Const_Delete: TMenuItem;
pmi_Const_New: TMenuItem;
atnlst_Main: TActionList;
mm_Main: TMainMenu;
actn_Const_New: TAction;
mmi_Const: TMenuItem;
mmi_Const_New: TMenuItem;
actn_Const_Cancel: TAction;
actn_Const_Save: TAction;
actn_Const_Delete: TAction;
actn_Const_Print: TAction;
actn_Const_Find: TAction;
actn_Const_Close: TAction;
actn_Const_UserControl: TAction;
actn_Const_Edit: TAction;
mmi_Const_Edit: TMenuItem;
waps_Const: TwenActionPass;
pnl_Main: TPanel;
rxdbg_Main: TRxDBGrid;
actn_Const_Refresh: TAction;
dk97_SelfHome: TDock97;
tbar97_Self: TToolbar97;
tbtn97_Const_Delete: TToolbarButton97;
tbtn97_Const_New: TToolbarButton97;
tbtn97_Const_Edit: TToolbarButton97;
tbtn97_Const_Cancel: TToolbarButton97;
tbtn97_Const_Save: TToolbarButton97;
tbs97_1: TToolbarSep97;
tbtn97_Const_Find: TToolbarButton97;
tbtn97_Const_Print: TToolbarButton97;
mmi_Const_Cancel: TMenuItem;
mmi_Const_Save: TMenuItem;
mmi_Const_Delete: TMenuItem;
mmi_Const_temp1: TMenuItem;
mmi_Const_Print: TMenuItem;
mmi_Const_Find: TMenuItem;
mmi_Const_temp2: TMenuItem;
mmi_Const_Close: TMenuItem;
il_MainEn: TImageList;
tbs97_2: TToolbarSep97;
tbtn97_Const_Close: TToolbarButton97;
sbx_Top: TScrollBox;
pnl_Top: TPanel;
pnl_TopChild: TPanel;
spl_Main: TSplitter;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormActivate(Sender: TObject);
procedure rxdbg_MainKeyPress(Sender: TObject; var Key: Char);
procedure pmi_Const_DeleteClick(Sender: TObject);
procedure pmi_Const_NewClick(Sender: TObject);
procedure actn_Const_NewExecute(Sender: TObject);
procedure actn_Const_CancelExecute(Sender: TObject);
procedure actn_Const_SaveExecute(Sender: TObject);
procedure actn_Const_DeleteExecute(Sender: TObject);
procedure actn_Const_PrintExecute(Sender: TObject);
procedure actn_Const_FindExecute(Sender: TObject);
procedure actn_Const_CloseExecute(Sender: TObject);
procedure actn_Const_EditExecute(Sender: TObject);
procedure actn_Const_UserControlExecute(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure actn_Const_RefreshExecute(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDeactivate(Sender: TObject);
procedure sbx_TopResize(Sender: TObject);
private
{ Private declarations }
CancelStatus : boolean;
//MutiStatus : boolean;
InsertStatus: boolean;
FFormEditStatus: boolean;
procedure SetFormEditStatus(Sender: boolean);
public
{ Public declarations }
property FormEditStatus : Boolean read FFormEditStatus write SetFormEditStatus;
//constructor FormCreate(AOwner: TComponent;form:TForm);
procedure ShowForm(CurrentForm:TForm);
end;
implementation
uses SystemPH;
//uses pubMainFM;
{$R *.DFM}
{constructor Tsystem_Bill_00.FormCreate(AOwner: TComponent;form:TForm);
begin
inherited Create(AOwner);
end;}
procedure Tfrm_pubBill.ShowForm(CurrentForm:TForm);
begin
try
CurrentForm.ShowModal;
finally
CurrentForm.Free;
end;
end;
procedure Tfrm_pubBill.SetFormEditStatus(Sender: boolean);
begin
{if MutiStatus then
begin
Panel2.Enabled := FormEditStatus;
//Main_Form.Find_ToolButton.Enabled := not FormEditStatus;
end;
// else
// Main_Form.Find_ToolButton.Enabled := False;
SetDetailFormOption;}
FFormEditStatus := Sender;
if Sender then
waps_Const.PassMask:='01100000'
else
waps_Const.PassMask:='10011111';
Actn_Const_UserControl.Execute;
end;
procedure Tfrm_pubBill.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
if screen.FormCount=2 then WebIsHide(0);
Action := caFree;
end;
procedure Tfrm_pubBill.FormKeyPress(Sender: TObject; var Key: Char);
begin
if pnl_TopChild.Enabled = True then
if (Key = #13) {and (not (ActiveControl.Name = 'Goods_DBGrid')) }then
SelectNext(ActiveControl,True,True);
end;
procedure Tfrm_pubBill.rxdbg_MainKeyPress(Sender: TObject;
var Key: Char);
var
I,J : integer;
begin
if key = #13 then
begin
I := rxdbg_Main.FieldCount;
J := rxdbg_Main.SelectedIndex;
if J < I then
rxdbg_Main.SelectedField :=rxdbg_Main.Fields[J+1]
else
rxdbg_Main.selectedField :=rxdbg_Main.Fields[1];
end;
end;
procedure Tfrm_pubBill.pmi_Const_DeleteClick(Sender: TObject);
begin
if (not rxdbg_Main.Focused) and (not FormEditStatus)
then abort;
end;
procedure Tfrm_pubBill.pmi_Const_NewClick(Sender: TObject);
begin
if (not rxdbg_Main.Focused) and (not FormEditStatus)
then abort;
end;
procedure Tfrm_pubBill.actn_Const_NewExecute(Sender: TObject);
begin
FormEditStatus := True;
InsertStatus := True;
Cancelstatus := False;
//if not MutiStatus then panel2.Enabled := True;
if (Active) and (pnl_TopChild.Focused) then pnl_TopChild.Setfocus;
rxdbg_Main.Enabled:=false;
{if rxdbg_Main.enabled then} rxdbg_Main.Refresh ;
end;
procedure Tfrm_pubBill.actn_Const_CancelExecute(Sender: TObject);
begin
CancelStatus := True;
FormEditStatus := False;
InsertStatus := False;
if (Active) and (pnl_TopChild.Focused) then pnl_TopChild.Setfocus;
rxdbg_Main.Enabled:=true;
if rxdbg_Main.enabled then rxdbg_Main.Refresh ;
end;
procedure Tfrm_pubBill.actn_Const_SaveExecute(Sender: TObject);
begin
//SelectNext(ActiveControl,True,True);
FormEditStatus:=False;
rxdbg_Main.Enabled:=true;
if rxdbg_Main.enabled then rxdbg_Main.Refresh ;
end;
procedure Tfrm_pubBill.actn_Const_DeleteExecute(Sender: TObject);
begin
//if MessageDlg('是否删除这张单据?',mtConfirmation,[mbYes,mbNo],0) = mrNO then
end;
procedure Tfrm_pubBill.actn_Const_PrintExecute(Sender: TObject);
begin
FormEditStatus:=False;
end;
procedure Tfrm_pubBill.actn_Const_FindExecute(Sender: TObject);
begin
FormEditStatus:=False;
end;
procedure Tfrm_pubBill.actn_Const_CloseExecute(Sender: TObject);
begin
Close;
end;
procedure Tfrm_pubBill.actn_Const_EditExecute(Sender: TObject);
begin
FormEditStatus := True;
InsertStatus := True;
Cancelstatus := False;
//if not MutiStatus then panel2.Enabled := True;
if (Active) and (pnl_TopChild.Focused) then pnl_TopChild.Setfocus;
rxdbg_Main.Enabled:=false;
{if rxdbg_Main.enabled then} rxdbg_Main.Refresh ;
end;
procedure Tfrm_pubBill.actn_Const_UserControlExecute(Sender: TObject);
begin
Actn_Const_Edit.Visible:=false;
end;
procedure Tfrm_pubBill.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
If FormEditStatus then
begin
if Application.MessageBox('是否退出?','提示',MB_YESNO+32) = mrYes then
begin
Actn_Const_Cancel.Execute;
CanClose := true;
end else
Abort;
end else
CanClose := true;
end;
procedure Tfrm_pubBill.actn_Const_RefreshExecute(Sender: TObject);
begin
FormEditStatus:=False;
end;
procedure Tfrm_pubBill.FormCreate(Sender: TObject);
begin
//tbar97_Self.AddDockForm(Application.MainForm);
//tbar97_Self.DockedTo:=Tfrm_pubMain(Application.MainForm).dk97_Home;
end;
procedure Tfrm_pubBill.FormActivate(Sender: TObject);
begin
FormEditStatus := FormEditStatus;
//if tbar97_Self.GetParentComponent<>Tfrm_pubBill(ActiveMDIChild).dk97_SelfHome then
// tbar97_Self.Visible:=false;
tbar97_Self.Visible:=true;
end;
procedure Tfrm_pubBill.FormDeactivate(Sender: TObject);
begin
if tbar97_Self.GetParentComponent<>dk97_SelfHome then
tbar97_Self.Visible:=true;
tbar97_Self.Visible:=false;
end;
procedure Tfrm_pubBill.sbx_TopResize(Sender: TObject);
begin
pnl_Top.Width:=sbx_Top.Width-3;
if sbx_Top.Width<pnl_TopChild.Width+15 then
begin
sbx_Top.AutoScroll:=true;
sbx_Top.HorzScrollBar.Visible:=true;
end else
begin
sbx_Top.AutoScroll:=false;
sbx_Top.HorzScrollBar.Visible:=false;
end;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?