From e76a1456885a8b916e3276d9c025eaf2855d29b8 Mon Sep 17 00:00:00 2001 From: sgwp <63001967@qq.com> Date: Tue, 22 Oct 2024 10:10:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81cxcheckbox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public10/design/U_FormLayOutDesign.pas | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/public10/design/U_FormLayOutDesign.pas b/public10/design/U_FormLayOutDesign.pas index 9195ad6..288217c 100644 --- a/public10/design/U_FormLayOutDesign.pas +++ b/public10/design/U_FormLayOutDesign.pas @@ -273,13 +273,15 @@ var combox:TcxCombobox; cxDateEdit:TcxDateEdit; cxButtonEdit:TcxButtonEdit; + cxCheckBox:TcxCheckBox; mwidth,i,j,cnt:integer; mdesignCode :String; begin mdesignCode := fDllFileName +'|'+layOut.Parent.name+ '|' + intTostr(formId) + '|' + gridName; - + layOut.BeginUpdate; // Postpones updates + try with AdoTmp do begin close; sql.Clear; sql.Add('select A.* '); @@ -293,9 +295,6 @@ begin exit; end; end; - - layOut.BeginUpdate; // Postpones updates - try // Creates a child group within the root group for i := 0 to layOut.Items.Count - 1 do begin @@ -360,6 +359,24 @@ begin ALayoutItem.Parent := ALayoutGroup; ALayoutItem.Name:= 'item_'+trim(AdoTmp.FieldByName('fieldName').AsString) ; + end + else if trim(AdoTmp.FieldByName('queryControlType').AsString)='checkBox' then + begin + cxCheckBox:= TcxCheckBox.Create(nil); + cxCheckBox.Name:= trim(AdoTmp.FieldByName('fieldName').AsString); + cxCheckBox.AlignWithMargins:=true; + cxCheckBox.Style.Font.Size:=gFontSize; + cxCheckBox.Caption:= trim(AdoTmp.FieldByName('caption').AsString) ; + cxCheckBox.TabOrder:=cnt; + cxCheckBox.Tag:=99; + // + if ALayoutItem=nil then + ALayoutItem := TdxLayoutItem(layOut.CreateItem); + ALayoutItem.Control := cxCheckBox; + ALayoutItem.CaptionOptions.Text:='';//trim(AdoTmp.FieldByName('caption').AsString) ; + ALayoutItem.Parent := ALayoutGroup; + ALayoutItem.Name:= 'item_'+trim(AdoTmp.FieldByName('fieldName').AsString) ; + end else if trim(AdoTmp.FieldByName('queryControlType').AsString)='date' then begin @@ -449,6 +466,7 @@ begin finally layOut.EndUpdate; // Resumes updates, even if an exception occurs + if layout.Items.VisibleCount=0 then layout.Visible:=false; end; end;