Using DBCTRL Grid

2.9k Views Asked by At

I am using TDBCtrl Grid, and I can only see one record to see next record I have to scroll however I have set RowCount=5. Also, my dbgridCTRL can only allow TDBEdit or TEdit controls. I want to display static text also. Can you please suggest How can I display the Labels on DBCTRL Grid.

enter image description here

This is how the currently looks like. The Rans Member etc are staticText control. However I want to display multiple records at the same time.

object DBCtrlGrid1: TDBCtrlGrid
  Left = 4
  Top = 2
  Width = 215
  Height = 122
  AllowDelete = False
  AllowInsert = False
  DataSource = DSCredit
  PanelHeight = 122
  PanelWidth = 199
  TabOrder = 0
  RowCount = 1
  OnPaintPanel = DBCtrlGrid1PaintPanel
end
1

There are 1 best solutions below

7
On

Height == PanelHeight * RowCount. And same for widths/columns.

You have to set sizes of panels and girds in a way, that several panels would fit inside the visible area of the grid. If the panel size is the same as the total size of all panels - then thereis just no places for other panels being visible.

PS. x-ref https://stackoverflow.com/questions/20658435/


Below is the example of DFM with the controls inside the Control Grid. The DFM example above shows empty grid without internal controls.

object Form9: TForm9
  Left = 0
  Top = 0
  Caption = 'Form9'
  ClientHeight = 390
  ClientWidth = 635
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object grid1: TDBCtrlGrid
    Left = 48
    Top = 38
    Width = 217
    Height = 300
    PanelHeight = 100
    TabOrder = 0
    object pnl1: TPanel
      Left = 0
      Top = 16
      Width = 185
      Height = 41
      Caption = 'pnl1'
      TabOrder = 0
      object dbedt1: TDBEdit
        Left = 48
        Top = 11
        Width = 121
        Height = 21
        TabOrder = 0
      end
    end
  end
end