cxDBVerticalGrid

时间:2024-07-10 12:05:50

定位在第一行并显示内置编辑器

cxDBVerticalGrid1.FocusedRow := cxDBVerticalGrid1.Rows[0]; 
cxDBVerticalGrid1.ShowEdit;


procedure TFrm_luru.Read_fllawmd;
var
  I: Integer;
  AItem: TcxDBEditorRow;
begin
  ShowHourglassCursor;
  try
    cxDBVerticalGrid.BeginUpdate;
    try
      with cxDBVerticalGrid.DataController.DataSet do
        for I := 0 to FieldCount - 1 do
        begin
              AItem := TcxDBEditorRow(cxDBVerticalGrid.Add(TcxDBEditorRow));
              with AItem.Properties do
              begin
                    DataBinding.FieldName := Fields[I].FieldName;
                    Caption := DataBinding.DefaultCaption;
                           if Fields[I].DataType=FtMemo then
                                 begin                                  EditPropertiesClassName:='TcxBlobEditProperties';
                                 end;
                              if Fields[I].DataType=ftDataSet then
                              begin
                                   cds:=Tclientdataset.Create(application);
                                   cds.DataSetField:=TDataSetField(Fields[I]);
                                   cds.Active:=true;
                                   cds.Edit;
                                   EditPropertiesClassName:='TcxButtonEditProperties';
                                   TcxButtonEditProperties(EditProperties).OnButtonClick:=ButtonClickDemo;
                              end;   
              end;
               AItem.Visible := Fields[I].Visible;

end;
    finally
      vv.EndUpdate;
    end;
  finally
    HideHourglassCursor;
  end;
end;


相关文章