From 9f38a6e3ace75338c4352510d5162920c8635a08 Mon Sep 17 00:00:00 2001 From: sgwp <63001967@qq.com> Date: Sun, 27 Apr 2025 17:22:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=86=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E5=88=97=E8=AE=BE=E7=BD=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../public10/design/U_FormLayOutDesign.pas | 10 ++++ .../public10/design/U_cxGridCustomSet.pas | 51 +++++++++++-------- 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/Delphi10/开发档案/Dp10RepoV1/public10/design/U_FormLayOutDesign.pas b/Delphi10/开发档案/Dp10RepoV1/public10/design/U_FormLayOutDesign.pas index 711debe..de0bf94 100644 --- a/Delphi10/开发档案/Dp10RepoV1/public10/design/U_FormLayOutDesign.pas +++ b/Delphi10/开发档案/Dp10RepoV1/public10/design/U_FormLayOutDesign.pas @@ -558,6 +558,11 @@ end; begin mcatpion:=StringReplace(mcatpion,'[COLOR=#FF0000]*[/COLOR]','',[rfIgnoreCase]); ShowMessage(''+mcatpion+',ݲΪ!'); + // ý + if (TdxLayoutItem(dxLayoutControl1.Items[i]).Control is TWinControl) then + begin + TWinControl(TdxLayoutItem(dxLayoutControl1.Items[i]).Control).SetFocus; + end; exit ; end; end; @@ -597,6 +602,11 @@ begin begin mcatpion:=StringReplace(mcatpion,'[COLOR=#FF0000]*[/COLOR]','',[rfIgnoreCase]); ShowMessage(''+mcatpion+',ݲΪ!'); + + if (TdxLayoutItem(dxLayoutGroup.Items[i]).Control is TWinControl) then + begin + TWinControl(TdxLayoutItem(dxLayoutGroup.Items[i]).Control).SetFocus; + end; exit ; end; end; diff --git a/Delphi10/开发档案/Dp10RepoV1/public10/design/U_cxGridCustomSet.pas b/Delphi10/开发档案/Dp10RepoV1/public10/design/U_cxGridCustomSet.pas index 37b8a19..a14f600 100644 --- a/Delphi10/开发档案/Dp10RepoV1/public10/design/U_cxGridCustomSet.pas +++ b/Delphi10/开发档案/Dp10RepoV1/public10/design/U_cxGridCustomSet.pas @@ -32,8 +32,7 @@ procedure ShowCxGridDesign(application: TApplication; function checkColumnMustIn(app: TApplication; tv1: TcxGridDBTableView; mFlag: integer): Boolean; // stdcall;external 'rtCommon.dll' Name 'checkColumnMustIn_A'; -function checkColumnMustIn_A(app: TApplication; tv1: TcxGridDBTableView; - client1: TClientDataSet; mFlag: integer): Boolean; +function checkColumnMustIn_A(app: TApplication; tv1: TcxGridDBTableView;client1: TClientDataSet; mFlag: integer): Boolean; procedure getColumnRelation(tv1: TcxGridDBTableView; client1: TClientDataSet); function SaveGridSetInfoToBase(mCxGridView: TcxGridDBTableView; client1:TClientDataSet; ADOCmd: TADOQuery; designCode: string): Boolean; @@ -473,8 +472,7 @@ end; // end; // -function checkColumnMustIn(app: TApplication; tv1: TcxGridDBTableView; - mFlag: integer): Boolean; +function checkColumnMustIn(app: TApplication; tv1: TcxGridDBTableView;mFlag: integer): Boolean; var i: integer; client1: TClientDataSet; @@ -520,25 +518,38 @@ end; mfieldName:string; begin result:=false; - for i := 0 to tv1.ColumnCount-1 do - begin - // ADBColumn :=TcxGridDBColumn( tv1.Columns[i] ); - if tv1.Columns[i].Tag = mFlag then + try + tv1.DataController.DataSet.DisableControls; + for i := 0 to tv1.ColumnCount-1 do begin - with tv1.DataController.DataSet do // - begin - if not client1.Locate('caption',tv1.Columns[i].Caption,[]) then Continue; - if tv1.Columns[i].DataBinding.Field.DataType<>ftString then Continue ; - mfieldName :=trim( client1.FieldByName('fieldName').AsString); - if locate( mfieldName, null, []) or locate( mfieldName, '', []) then - begin - Application.MessageBox(PChar(tv1.Columns[i].Caption + 'Ϊ!'), 'ʾ', 0); - exit; - end; - end; + if tv1.Columns[i].Tag = mFlag then + begin + with tv1.DataController.DataSet do // + begin + // if not client1.Locate('caption',tv1.Columns[i].Caption,[]) then Continue; + // if tv1.Columns[i].DataBinding.Field.DataType<>ftString then Continue ; + mfieldName :=trim(tv1.Columns[i].DataBinding.FieldName); + First; + while not eof do + begin + if trim(FieldByName(mfieldName).AsString) = '' then + begin + Application.MessageBox(pchar(''+PChar(tv1.Columns[i].Caption + 'Ϊ!')), 'ʾ', 0); + + // tv1.Controller.FocusedRowIndex := 0; + // tv1.Controller.FocusedColumn:=tv1.Columns[i] ; + // tv1.Controller.MakeFocusedItemVisible ; + exit; + end; + Next; + end; + end; + end; end; + result:=true; + finally + tv1.DataController.DataSet.EnableControls ; end; - result:=true; end; ///////////////////////////////////