📄 winuser.~pas
字号:
item_clear();
ToolBar1.Buttons[2].Enabled := false; //保存按钮不可用
RefreshEnabled(false,false);
except
on ex:Exception do
begin
messagebox.Show('TWinUser.TWinUser_Load : (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
//****************************************************************
//* 窗体卸载 [Closed]
//*
//* [参数]
//* 1:系统参数
//* 2:系统参数
//* [返回]
//* 无
//****************************************************************
procedure TWinuser.TWinuser_Closed(sender: System.Object; e: System.EventArgs);
begin
try
clsmain.WinUserShowFla:=false;
except
on ex:Exception do
begin
messagebox.Show('TWinUser.TWinUser_Closed : (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
//****************************************************************
//* TWinUser_KeyDown
//*
//* [参数]
//* 1:系统参数
//* 2:系统参数
//* [返回]
//* 无
//****************************************************************
procedure TWinuser.TWinuser_KeyDown(sender: System.Object; e: System.Windows.Forms.KeyEventArgs);
begin
try
Case e.KeyCode of
//--- F7 按下=焦点移动到"信息维护"选项卡页
Keys.F7:
begin
e.Handled := False;
TabControl1.SelectedTab := TabControl1.TabPages[0];
end;
//--- F9 按下=焦点移动到"信息查询"选项卡页
Keys.F9:
begin
e.Handled := False;
TabControl1.SelectedTab := TabControl1.TabPages[1];
end;
end;
except
on ex:Exception do
begin
messagebox.Show('TWinUser.TWinUser_KeyDown : (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
//****************************************************************
//* TWinUser_KeyPress
//*
//* [参数]
//* 1:系统参数
//* 2:系统参数
//* [返回]
//* 无
//****************************************************************
procedure TWinuser.TWinuser_KeyPress(sender: System.Object; e: System.Windows.Forms.KeyPressEventArgs);
begin
try
Case e.KeyChar of
char(13):
begin
e.Handled := False;
SendKeys.Send('{Tab}');
end;
end;
except
on ex:Exception do
begin
messagebox.Show('TWinUser.TWinUser_KeyPress : (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
//****************************************************************
//* 窗体项目清空
//*
//* [参数]
//* 无
//* [返回]
//* 无
//****************************************************************
procedure TWinuser.Item_Clear;
begin
try
self.TextUser.text:='';
self.TextPass.text:='';
self.CmbQuanXian.text:='';
self.TextUserF.text:='';
self.TextPassF.text:='';
self.CmbQuanXianF.text:='';
except
on ex:Exception do
begin
messagebox.Show('TWinUser.Item_Clear : (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
//****************************************************************
//* RefreshEnabled
//*
//* [参数]
//* 1:用户名的可用状态
//* 2:其它输入控件的可用状态
//* [返回]
//* 无
//****************************************************************
procedure TWinuser.RefreshEnabled(NThis, NOther: Boolean);
begin
try
If NThis = True Then
begin
TextUser.ReadOnly := False;
end
Else
begin
TextUser.ReadOnly := True;
end;
TextPass.Enabled := NOther;
CmbQuanXian.Enabled := NOther;
except
on ex:Exception do
begin
messagebox.Show('TWinUser.RefreshEnabled : (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
//****************************************************************
//* 项目Check
//*
//* [参数]
//* 无
//* [返回]
//* 1:输入ERR有无 (True:ERR没有、 False:ERR有)
//****************************************************************
function TWinuser.Item_Check: Boolean;
begin
try
//用户名
If Check_TextUser()=False Then
begin
self.TextUser.Focus();
Exit;
End;
//密码
If Check_TextPass()=False Then
begin
self.TextPass.Focus();
Exit;
End;
//权限
If Check_CmbQuanXian()=False Then
begin
self.CmbQuanXian.Focus();
Exit;
End;
//返回值设定
result:= True; //正常返回设定
except
on ex:Exception do
begin
messagebox.Show('TWinUser.Item_Check : (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
//****************************************************************
//* 项目CheckF
//*
//* [参数]
//* 无
//* [返回]
//* 1:输入ERR有无 (True:ERR没有、 False:ERR有)
//****************************************************************
function TWinuser.Item_CheckF: Boolean;
begin
try
//用户名F
If Check_TextUserF()=False Then
begin
self.TextUserF.Focus();
Exit;
End;
//密码F
If Check_TextPassF()=False Then
begin
self.TextPassF.Focus();
Exit;
End;
//返回值设定
result:= True; //正常返回设定
except
on ex:Exception do
begin
messagebox.Show('TWinUser.Item_CheckF : (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
//****************************************************************
//* 用户名 项目Check
//*
//* [参数]
//* 无
//* [返回]
//* 1:输入ERR有无 (True:ERR没有、 False:ERR有)
//****************************************************************
function TWinuser.Check_TextUser: Boolean;
var
w_textuser:string;
begin
try
w_TextUser := TextUser.Text.Trim();
//输入位数Check
If w_TextUser.Length > 20 Then
begin
messagebox.Show('输入长度超出最大范围','用户管理');
result:= false;
Exit;
End;
//必须输入Check
If w_TextUser.Length = 0 Then
begin
messagebox.Show('此项目不能省略','用户管理');
result:= false;
Exit;
End;
//返回值设定
result:= True; //正常返回设定
except
on ex:Exception do
begin
result:=false;
messagebox.Show('TWinUser.Check_TextUser : (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
//****************************************************************
//* 密码 项目Check
//*
//* [参数]
//* 无
//* [返回]
//* 1:输入ERR有无 (True:ERR没有、 False:ERR有)
//****************************************************************
function TWinuser.Check_TextPass: Boolean;
var
w_textpass:string;
begin
try
w_TextPass := TextPass.Text.Trim();
//输入位数Check
If w_TextPass.Length > 20 Then
begin
messagebox.Show('输入长度超出最大范围','用户管理');
result:= false;
Exit;
End;
//必须输入Check
If w_TextPass.Length = 0 Then
begin
messagebox.Show('此项目不能省略','用户管理');
result:= false;
Exit;
End;
//返回值设定
result:= True; //正常返回设定
except
on ex:Exception do
begin
result:=false;
messagebox.Show('TWinUser.Check_TextPass : (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
//****************************************************************
//* 权限 项目Check
//*
//* [参数]
//* 无
//* [返回]
//* 1:输入ERR有无 (True:ERR没有、 False:ERR有)
//****************************************************************
function TWinuser.Check_CmbQuanXian: Boolean;
var
w_CmbQuanXian:string;
begin
try
w_CmbQuanXian := CmbQuanXian.Text.Trim();
//必须输入Check
If w_CmbQuanXian ='' Then
begin
messagebox.Show('此项目不能省略','用户管理');
result:= false;
Exit;
End;
//返回值设定
result:= True; //正常返回设定
except
on ex:Exception do
begin
result:=false;
messagebox.Show('TWinUser.Check_CmbQuanXian : (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
//****************************************************************
//* 用户名F 项目Check
//*
//* [参数]
//* 无
//* [返回]
//* 1:输入ERR有无 (True:ERR没有、 False:ERR有)
//****************************************************************
function TWinuser.Check_TextUserF: Boolean;
var
w_textuserF:string;
begin
try
w_TextUserF := TextUserF .Text.Trim();
//输入位数Check
If w_TextUserF .Length > 20 Then
begin
messagebox.Show('输入长度超出最大范围','用户管理');
result:= false;
Exit;
End;
//返回值设定
result:= True; //正常返回设定
except
on ex:Exception do
begin
result:=false;
messagebox.Show('TWinUser.Check_TextUserF : (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
//****************************************************************
//* 密码F 项目Check
//*
//* [参数]
//* 无
//* [返回]
//* 1:输入ERR有无 (True:ERR没有、 False:ERR有)
//****************************************************************
function TWinuser.Check_TextPassF: Boolean;
var
w_textpassF:string;
begin
try
w_TextPassF := TextPassF .Text.Trim();
//输入位数Check
If w_TextPassF .Length > 20 Then
begin
messagebox.Show('输入长度超出最大范围','用户管理');
result:= false;
Exit;
End;
//返回值设定
result:= True; //正常返回设定
except
on ex:Exception do
begin
result:=false;
messagebox.Show('TWinUser.Check_TextPassF : (' + ex.message + ') ' , '考勤管理系统');
end;
end;
end;
//****************************************************************
//* ToolBar1_ButtonClick
//*
//* [参数]
//* 1:系统参数
//* 2:系统参数
//* [返回]
//* 无
//****************************************************************
procedure TWinuser.ToolBar1_ButtonClick(sender: System.Object; e: System.Windows.Forms.ToolBarButtonClickEventArgs);
begin
try
Case strtoint(e.Button.Tag.ToString) of
1://添加
begin
Flg := '添加';
ToolBar1.Buttons[1].Enabled := False; //编辑按钮不可用
ToolBar1.Buttons[2].Enabled := True; //保存按钮可用
ToolBar1.Buttons[3].Enabled := False; //删除按钮不可用
Item_Clear();
RefreshEnabled(True, True);
end;
2://编辑
begin
If TextUser.Text = '' Then
begin
messagebox.Show('无修改数据。', '考勤管理系统');
end
else
begin
Flg := '编辑';
ToolBar1.Buttons[0].Enabled := False; //添加按钮不可用
ToolBar1.Buttons[2].Enabled := True; //保存按钮可用
ToolBar1.Buttons[3].Enabled := False; //删除按钮不可用
RefreshEnabled(False, True);
End;
end;
3://保存
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -