RtTool/Delphi7/开发档案/马国钢开发代码/ThreeFun/formPas/U_WinFormRight.pas

172 lines
5.2 KiB
ObjectPascal
Raw Normal View History

2025-01-08 11:55:07 +08:00
unit U_WinFormRight;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolWin, StdCtrls, BtnEdit, cxStyles, cxCustomData,
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit,DBGrids, DB, cxDBData,
cxGridLevel, cxClasses, cxControls, cxGridCustomView, ADODB,StrUtils,
Midas,cxGridCustomTableView, cxGridTableView, cxGridDBTableView,cxTimeEdit,
cxGrid,cxDBLookupComboBox,cxCalendar, cxCurrencyEdit,cxExportGrid4Link,
ExtCtrls, Buttons,DBClient,FTComboBox,cxDropDownEdit,cxMemo;
var
gP1:string;
gP2:string;
gP3:string;
gP4:string;
gP5:string;
procedure SetFormCtrlRight(mWinFormRight:string;mParent:TWinControl);
procedure SetWinFormCtrlOperRight(ADOQueryTmp:TADOQuery;mParent:TWinControl;frmName:string);
procedure SetWinFormDispCSS(ADOQueryTmp:TADOQuery;mParent:TWinControl);
implementation
uses
U_global;
//////////////////////////////////////////////////////////////
//mWinFormRight:1: <20>˲<EFBFBD><CBB2><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>򴫽<EFBFBD><F2B4ABBD>Ŀ<EFBFBD><C4BF>ƴ<EFBFBD><C6B4><EFBFBD>Ȩ<EFBFBD>޵IJ<DEB5><C4B2><EFBFBD><EFBFBD><EFBFBD>
// 2<><32>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ʴ<EFBFBD>ֵ
//mParent:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>toolBar;Ҳ<><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>panel<65><6C>groupBox<6F><78><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//////////////////////////////////////////////////////////////
procedure SetFormCtrlRight(mWinFormRight:string;mParent:TWinControl);
var
i:integer;
mCaption:string;
begin
if mWinFormRight='' then exit;
try
///////////////////////////////////////////////
if mParent is TtoolBar then
begin
for i:=0 to TtoolBar(mParent).ButtonCount-1 do
begin
mCaption:=trim(TtoolBar(mParent).Buttons[i].Caption);
if (mCaption='<27>ر<EFBFBD>') or (mCaption='<27>˳<EFBFBD>') or (mCaption='<27><><EFBFBD><EFBFBD>') then exit;
/////////////////////////////
if trim(mWinFormRight)='<27><>ѯ' then
begin
if pos(mCaption, '<27><>ѯ,ˢ<><CBA2>,<2C><><EFBFBD><EFBFBD>,<2C>߼<EFBFBD><DFBC><EFBFBD>ѯ')>0 then //,<2C>鿴,<2C><>ϸ
begin
//TtoolBar(mParent).Buttons[i].Enabled :=false;
TtoolBar(mParent).Buttons[i].Visible :=true;
end
else
begin
TtoolBar(mParent).Buttons[i].Visible :=false;
end;
end
else
begin
if (pos(mCaption,mWinFormRight)>0 )
or (pos(mCaption, '<27><>ѯ,ˢ<><CBA2>,<2C><><EFBFBD><EFBFBD>,<2C>߼<EFBFBD><DFBC><EFBFBD>ѯ,<2C><>ϸ')>0) then //<2F>鿴,
begin
TtoolBar(mParent).Buttons[i].Visible :=true;
end
else
begin
TtoolBar(mParent).Buttons[i].Visible :=false;
end;
end;
end;
exit;
end;
///////////////////////////////////////////////////
if trim(mWinFormRight)='<27><>ѯ' then exit;
with mParent do
begin
for i:=0 to ControlCount-1 do
begin
mCaption:='';
if (Controls[i] is TBitBtn) then
mCaption:=trim(TBitBtn(Controls[i]).Caption)
else if (Controls[i] is TButton) then
mCaption:=trim(TButton(Controls[i]).Caption)
else if (Controls[i] is TSpeedButton) then
mCaption:=trim(TSpeedButton(Controls[i]).Caption)
else
continue;
if (Controls[i] is TBitBtn)
or (Controls[i] is TButton)
or (Controls[i] is TSpeedButton) then
begin
if (pos(mCaption, mWinFormRight)>0)
or (mCaption='<27><>ѯ') or (mCaption='<27><><EFBFBD><EFBFBD>') or (mCaption='<27>߼<EFBFBD><DFBC><EFBFBD><EFBFBD><EFBFBD>') then
begin
Controls[i].Visible :=true;
end
else
Controls[i].Visible :=false;
end;
end;
end;
except
application.MessageBox('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ',0);
end;
end;
//////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////
procedure SetWinFormCtrlOperRight(ADOQueryTmp:TADOQuery;mParent:TWinControl;frmName:string);
var
i:integer;
mtable, mfield:string;
begin
with ADOQueryTmp do
begin
close;
sql.Clear ;
sql.Add('select * from XC_FormFieldOperCtrl');
sql.Add('where valid=''Y''');
Open;
if IsEmpty then exit;
end;
with mParent do
begin
for i:=0 to ControlCount-1 do
begin
if Controls[i] is TLabel then continue;
//SplitCtrName(Controls[i].Name,'9',mtable,mfield) ;
if ADOQueryTmp.Locate('moduleName;fieldByName',varArrayOf([frmName,mfield]),[]) then
begin
if Controls[i] is Tmemo then
Tmemo(Controls[i]).ReadOnly :=true
else if Controls[i] is Tcxmemo then
(Controls[i] as Tcxmemo).Properties.ReadOnly :=true
else
Controls[i].Enabled :=false;
end;
end;
end;
end;
///////////////////////////////////////////////////////////////////////////
//<2F><><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD><EFBFBD><EFBFBD>ʽ
///////////////////////////////////////////////////////////////////////////
procedure SetWinFormDispCSS(ADOQueryTmp:TADOQuery;mParent:TWinControl);
begin
try
with ADOQueryTmp do
begin
close;
sql.Clear ;
sql.Add('select * ');
sql.Add('from XS_ErpParam');
sql.Add('where SetId=''S100''');
sql.Add('and SetType=''FORM''');
Open;
if RecordCount>0 then
begin
//P1 ToolBar<61><72>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
if trim(fieldByName('P1').AsString) ='0' then
TtoolBar(mParent).List :=false
else
TtoolBar(mParent).List :=true;
end;
close;
end;
except
end;
end;
end.