168 lines
6.2 KiB
ObjectPascal
168 lines
6.2 KiB
ObjectPascal
unit U_FormLayOutDesign;
|
||
interface
|
||
uses
|
||
Windows, SysUtils, Messages, Classes, Controls, StdCtrls, ComCtrls, Forms,
|
||
ExtCtrls, ComObj, DXCORE, ActiveX, cxMemo, cxButtons, Graphics, IniFiles,
|
||
Dialogs, Menus, DB, ADODB, cxLabel, BtnEdit, RTComboBox, cxTextEdit, cxMRUEdit,
|
||
cxDBData, cxGridLevel, cxButtonEdit, cxCurrencyEdit, cxGridTableView, cxGrid,
|
||
cxGridCustomTableView, cxGraphics, cxCalendar, cxCheckBox, cxGridDBTableView,
|
||
cxGridDBBandedTableView, cxStyles, cxPc, cxGroupBox, dxLayoutContainer, U_dataLink,
|
||
cxCustomData, cxClasses, cxTimeEdit, cxEdit, cxLookAndFeels, dxLayoutControl,
|
||
cxLookAndFeelPainters, cxGridCustomView, Buttons, cxDropDownEdit,dxSkinsCore, dxSkinWXI,dxSkinsDefaultPainters;
|
||
|
||
|
||
//function saveLayOut(dxLayoutControl1:TdxLayoutControl; ADOCmd: TADOQuery;mdesignCode:string):Boolean;
|
||
function readLayOut(dxLayoutControl1:TdxLayoutControl; ADOTmp: TADOQuery;mdesignCode:string):Boolean;
|
||
//function mustInCheck(dxLayoutControl1:TdxLayoutControl ;textFlag:string='*'):Boolean;
|
||
procedure SetFormOperRight(app:Tapplication;mParent: TwinControl; mRightCaptions: PWideChar)stdcall;external 'rtCommon.dll' Name 'SetFormOperRight_A';
|
||
function getSystemFontSize(ADOTmp: TADOQuery;mStyleCode:PWideChar): Integer;stdcall;external 'rtCommon.dll' Name 'getSystemFontSize_A';
|
||
function mustInCheck(app:Tapplication;dxLayoutControl1:TdxLayoutControl;textFlag:PWideChar):boolean;stdcall;external 'rtCommon.dll' Name 'mustInCheck_A';
|
||
function isHasDesignRight(ADOTmp: TADOQuery;userId:PWideChar): boolean;stdcall;external 'rtCommon.dll' Name 'isHasDesignRight_A';
|
||
//function readLayOut(app:Tapplication;dxLayoutControl1:TdxLayoutControl; ADOTmp: TADOQuery;mdesignCode:PWideChar):integer;stdcall;external 'rtCommon.dll' Name 'readLayOut_A';
|
||
function saveLayOut(app:Tapplication;dxLayoutControl1:TdxLayoutControl; ADOCmd: TADOQuery;mdesignCode:PWideChar):integer;stdcall;external 'rtCommon.dll' Name 'saveLayOut_A';
|
||
procedure layoutDesign(dxLayoutControl1:TdxLayoutControl;ADOTmp: TADOQuery;userId:PWideChar )stdcall;external 'rtCommon.dll' Name 'layoutDesign_A';
|
||
procedure SetShowModalHide(mHandle:Thandle;form:Tform)stdcall;external 'rtCommon.dll';
|
||
procedure InitStyleData( StyleRepository:TcxStyleRepository;mFontSize:integer);
|
||
function GetsysParam(AdoTmp:Tadoquery;StyleRepository:TcxStyleRepository;muserId: pchar; fparam1: pchar): Boolean;
|
||
implementation
|
||
uses
|
||
U_globalVar;
|
||
|
||
//
|
||
function readLayOut(dxLayoutControl1:TdxLayoutControl; ADOTmp: TADOQuery;mdesignCode:string):Boolean;
|
||
var
|
||
LayoutStream: TMemoryStream;
|
||
begin
|
||
LayoutStream := TMemoryStream.Create;
|
||
try
|
||
dxLayoutControl1.BeginUpdate ;
|
||
with ADOTmp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select A.* ');
|
||
sql.Add('from SD_Design_FormLayout A');
|
||
sql.Add('where A.designCode=' + quotedStr(mdesignCode));
|
||
open;
|
||
|
||
if RecordCount>0 then
|
||
begin
|
||
TBlobField(FieldByName('fileContent')).SaveToStream(LayoutStream) ;
|
||
LayoutStream.Seek(0,soFromBeginning);
|
||
dxLayoutControl1.LoadFromStream(LayoutStream);
|
||
end;
|
||
Close;
|
||
end;
|
||
finally
|
||
dxLayoutControl1.EndUpdate();
|
||
LayoutStream.Free; // <20>ͷ<EFBFBD><CDB7>ڴ<EFBFBD><DAB4><EFBFBD>
|
||
end;
|
||
end;
|
||
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
// function mustInCheck(dxLayoutControl1:TdxLayoutControl ;textFlag:string='*'):Boolean;
|
||
// var
|
||
// i:integer;
|
||
// j:Integer;
|
||
// mcatpion:string;
|
||
// layGroup:TdxLayoutGroup;
|
||
// begin
|
||
// result:=false;
|
||
// for I := 0 to dxLayoutControl1.Items.Count-1 do
|
||
// begin
|
||
// // mcatpion:= TdxLayoutItem(dxLayoutControl1.Controls[i].Parent).caption ;
|
||
// // if pos(textFlag, mcatpion)>=0 then
|
||
// // begin
|
||
// // ShowMessage(dxLayoutControl1.Items[i].name);
|
||
// // end;
|
||
//
|
||
// if dxLayoutControl1.Items[i] is TdxLayoutGroup then
|
||
// begin
|
||
// layGroup := TdxLayoutGroup( dxLayoutControl1.Items[i]) ;
|
||
// for j := 0 to layGroup.Count -1 do
|
||
// begin
|
||
// // ShowMessage(layGroup.items[j].name);
|
||
// mcatpion:= TdxLayoutItem(layGroup.items[j]).Caption ;
|
||
// if pos(textFlag, mcatpion)>0 then
|
||
// begin
|
||
// if TdxLayoutItem(layGroup.items[j]).Control is TcxTextEdit then
|
||
// begin
|
||
// if Trim(TcxTextEdit(TdxLayoutItem(layGroup.items[j]).Control).Text) ='' then
|
||
// begin
|
||
// //
|
||
// mcatpion:=StringReplace(mcatpion,'[COLOR=#FF0000]*[/COLOR]','',[]);
|
||
// TcxTextEdit(TdxLayoutItem(layGroup.items[j]).Control).TextHint:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>';
|
||
// TcxTextEdit(TdxLayoutItem(layGroup.items[j]).Control).SetFocus;
|
||
// ShowMessage('<27><>'+mcatpion+'<27><>,<2C><><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!');
|
||
//
|
||
// exit ;
|
||
// end;
|
||
// continue;
|
||
// end;
|
||
// //
|
||
// if TdxLayoutItem(layGroup.items[j]).Control is TcxButtonEdit then
|
||
// begin
|
||
// if Trim(TcxButtonEdit(TdxLayoutItem(layGroup.items[j]).Control).Text) ='' then
|
||
// begin
|
||
// //
|
||
// mcatpion:=StringReplace(mcatpion,'[COLOR=#FF0000]*[/COLOR]','',[]);
|
||
// // TcxButtonEdit(TdxLayoutItem(layGroup.items[j]).Control).TextHint:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>';
|
||
// TcxButtonEdit(TdxLayoutItem(layGroup.items[j]).Control).SetFocus;
|
||
// ShowMessage('<27><>'+mcatpion+'<27><>,<2C><><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!');
|
||
//
|
||
// exit ;
|
||
// end;
|
||
// continue;
|
||
// end;
|
||
//
|
||
// end;
|
||
// end;
|
||
//
|
||
// end;
|
||
//
|
||
// end;
|
||
// result:=true;
|
||
// end;
|
||
|
||
////////////////////////////////////
|
||
procedure InitStyleData( StyleRepository:TcxStyleRepository;mFontSize:integer);
|
||
var
|
||
i:integer;
|
||
begin
|
||
if mFontSize<9 then mFontSize:=9;
|
||
|
||
for i := 0 to StyleRepository.Count-1 do
|
||
begin
|
||
TcxStyle( StyleRepository.Items[i] ).Font.Size:=mFontSize;
|
||
end;
|
||
end;
|
||
|
||
///
|
||
function GetsysParam(AdoTmp:Tadoquery;StyleRepository:TcxStyleRepository;muserId: pchar; fparam1: pchar): Boolean;
|
||
var
|
||
i:integer;
|
||
begin
|
||
result := true;
|
||
//////////////////////////////
|
||
// shortDateFormat := 'yyyy-MM-dd';
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
with AdoTmp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select getDate()as dt');
|
||
open;
|
||
DServerDate := fieldByName('dt').AsDatetime;
|
||
end;
|
||
gFontSize:= getSystemFontSize(AdoTmp,PWideChar('01'));
|
||
|
||
for i := 0 to StyleRepository.Count-1 do
|
||
begin
|
||
if gFontSize>=9 then
|
||
TcxStyle( StyleRepository.Items[i] ).Font.Size:=gFontSize;
|
||
end;
|
||
result := true;
|
||
end;
|
||
|
||
end.
|