📄 u_web_dict.pas
字号:
end;
end;
case m_lang of
1: s := '编码*16*中文名称*30*英文名称*32*数据状态*16*';
2: s := 'CODE*16*NAME*30*ENG NAME*32*DATA STAT*16*';
end;
title_sg_wy(sg_jl, s, false);
lb_no.Caption := iif(m_lang = 1, '编码', 'RSV TYPE CODE');
with sg_jl do
with f_web_dm.qy_wangy do
begin
close;
sql.clear;
sql.add('select code,name,namee from dictdb where flag=:vflag order by code');
parambyname('vflag').asinteger := m_diff;
open;
while not eof do
begin
str_grid_wy(sg_jl, arow);
cells[0, arow] := fields.Fields[0].asstring;
cells[1, arow] := fields.Fields[1].asstring;
cells[2, arow] := fields.Fields[2].asstring;
cells[colcount + 1, arow] := fields.Fields[0].asstring;
cells[colcount, arow] := 'normal';
next;
end;
close;
bztomc_wy(sg_jl, colcount, colcount - 1);
row := 1;
end;
end;
procedure TF_WEB_DICT.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
case Key of
VK_RETURN, VK_DOWN:
Perform(WM_NEXTDLGCTL, 0, 0);
VK_UP:
Perform(WM_NEXTDLGCTL, 1, 0);
VK_F2:
if bn_qd.Enabled and bn_qd.visible then
bn_qdclick(bn_qd);
VK_F3:
if bn_con.Enabled and bn_con.visible then
bn_conclick(bn_con);
VK_F4:
if bn_add.Enabled and bn_add.visible then
bn_addclick(bn_add);
VK_F5:
if bn_prn.Enabled and bn_prn.visible then
bn_prnclick(bn_prn);
VK_Escape: close;
end;
end;
procedure TF_WEB_DICT.SG_JLDblClick(Sender: TObject);
var
pos1: tpoint;
begin
getcursorpos(pos1);
pos1 := screentoclient(pos1);
if pos1.y < sg_jl.top + 21 then
exit;
clearpn_wy(pn_vip, true);
with sg_jl do
begin
if (row = 0) then
exit;
if not check_sg(sg_jl, row, true) then
exit;
updrow := row;
arow := updrow;
ed_depno.text := cells[0, arow];
ed_name.text := cells[1, arow];
ed_namee.text := cells[2, arow];
SortSettings.Show := false;
end;
bn_del.Enabled := true;
ed_depno.SetFocus;
end;
procedure TF_WEB_DICT.BN_DELClick(Sender: TObject);
begin
if messageDlg(del_msg, mtconfirmation, [mbyes, mbno], 0) = IDNO then
exit;
del_sg_wy(sg_jl, updrow, sg_jl.colcount, sg_jl.colcount - 1);
bn_del.Enabled := false;
clearpn_wy(pn_vip, true);
end;
procedure TF_WEB_DICT.ED_DEPNOKeyPress(Sender: TObject; var Key: Char);
begin
case m_diff of
10, 11, 14, 16: ; //key := key;
else
key := only_num(key);
end;
end;
procedure TF_WEB_DICT.ED_DEPNOExit(Sender: TObject);
var
s: string;
i: integer;
begin
ed_depno.Text := uppercase_wy(ed_depno.text);
s := trim(ed_depno.text);
i := length(s);
if i = 0 then
exit;
i := search_no(sg_jl, 0, s);
if (i > -1) and (i <> updrow) then
begin
MessageDlg(lb_no.caption + repeatstr(i), mtinformation, [mbok], 0);
ed_depno.SetFocus;
abort;
end;
end;
procedure TF_WEB_DICT.BN_CONClick(Sender: TObject);
begin
sg_locate_wy(sg_jl, sg_jl.colcount + 8);
sg_jl.ColCount := sg_jl.colcount + 9;
sg_jl.SortByColumn(sg_jl.ColCount - 1);
sg_jl.ColCount := sg_jl.colcount - 9;
setcursor(crDefault);
sg_jl.Row := 1;
sg_jl.Repaint;
end;
procedure TF_WEB_DICT.FormActivate(Sender: TObject);
begin
if windowstate <> wsMaximized then
windowstate := wsMaximized;
end;
procedure TF_WEB_DICT.BN_ADDClick(Sender: TObject);
begin
clearpn_wy(pn_vip, true);
updrow := -1;
ed_depno.SetFocus;
bn_del.Enabled := false;
end;
procedure TF_WEB_DICT.SG_JLGetCellColor(Sender: TObject; ARow,
ACol: Integer; AState: TGridDrawState; ABrush: TBrush; AFont: TFont);
var
i: integer;
begin
if arow = 0 then
exit;
with sg_jl do
begin
ABrush.color := clwhite;
i := strtoint(getstr(cells[colcount + 10, arow]));
if i = 1 then
ABrush.color := clInfoBk;
end;
end;
procedure TF_WEB_DICT.BN_PRNClick(Sender: TObject);
begin
tran_str := 'caption:' + caption + '*colcount:' + inttostr(lastcol_sg(sg_jl)) + '*rowcount:' + inttostr(sg_jl.rowcount) + '*';
F_WEB_GRIDPRN := TF_WEB_GRIDPRN.Create(self);
F_WEB_GRIDPRN.colselecth(sg_jl);
F_WEB_GRIDPRN.only_length;
F_WEB_GRIDPRN.Showmodal;
end;
procedure TF_WEB_DICT.ED_NAMEEExit(Sender: TObject);
var
s: string;
begin
ED_NAMEE.Text := uppercase_wy(ed_namee.text);
s := trim(ed_depno.Text);
if s = '' then
begin
MessageDlg(lb_no.Caption + null_msg, mtinformation, [mbok], 0);
ed_depno.SetFocus;
abort;
end;
s := trim(ed_name.Text);
if s = '' then
begin
MessageDlg(lb_name.Caption + null_msg, mtinformation, [mbok], 0);
ed_name.SetFocus;
abort;
end;
case m_diff of
12, 13, 19, 20, 22..24: ;
else // if m_diff <> 20 then
begin
s := trim(ed_namee.Text);
if s = '' then
begin
MessageDlg(lb_namee.Caption + null_msg, mtinformation, [mbok], 0);
ed_namee.SetFocus;
abort;
end;
end;
end;
with sg_jl do
begin
if updrow <> -1 then
begin
arow := updrow;
updrow := -1;
if cells[colcount, arow] <> 'add' then
cells[colcount, arow] := 'modify';
end
else
begin
str_grid_wy(sg_jl, arow);
cells[colcount, arow] := 'add';
end;
cells[0, arow] := ed_depno.text;
cells[1, arow] := ed_name.text;
cells[2, arow] := ed_namee.text;
SortSettings.Show := true;
bztomc_wy(sg_jl, colcount, colcount - 1);
end;
clearpn_wy(pn_vip, true);
ed_depno.SetFocus;
bn_del.enabled := false;
end;
procedure TF_WEB_DICT.ED_NAMEExit(Sender: TObject);
begin
ED_NAME.Text := uppercase_wy(ed_name.text);
end;
procedure TF_WEB_DICT.SG_JLCanSort(Sender: TObject; ACol: Integer;
var DoSort: Boolean);
begin
sg_jl.ColCount := sg_jl.ColCount + 5;
end;
procedure TF_WEB_DICT.SG_JLClickSort(Sender: TObject; ACol: Integer);
begin
sg_jl.ColCount := sg_jl.ColCount - 5;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -