TwwDBGrid + TwwDBLookupCombo 下拉列表

大致步骤  :

  1.  wwDBLookupCombo1,{位置任意}
  2.  wwDBGrid1  

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 418
  ClientWidth = 554
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object wwDBLookupCombo1: TwwDBLookupCombo  {查找表,就是下拉列表中可以看到的内容}
    Left = 96
    Top = 64
    Width = 121
    Height = 21
    DropDownAlignment = taLeftJustify
    Selected.Strings = (
      'fCode'#9'15'#9'fCode'#9'F'#9
      'fName'#9'24'#9'fName'#9'F'
      'fColor'#9'10'#9'fColor'#9'F'#9
      'fSpec'#9'10'#9'fSpec'#9'F'#9
      'fUnitsName'#9'10'#9'fUnitsName'#9#9)
    DataField = 'fPartID'
    DataSource = dsBOM
    LookupTable = TproductTable
    LookupField = 'fID'
    Options = [loColLines, loRowLines, loTitles]
    TabOrder = 0
    AutoDropDown = False
    ShowButton = True
    PreciseEditRegion = False
    AllowClearKey = False
  end


  object wwDBGrid1: TwwDBGrid
    Left = 0
    Top = 216
    Width = 554
    Height = 202
    ControlType.Strings = (
      'sPartCode;CustomEdit;wwDBLookupCombo1;F')
    Selected.Strings = (
      'sPartCode'#9'20'#9'sPartCode'
      'fPartID'#9'10'#9'fPartID'
      'fUnit'#9'50'#9'fUnit'
      'fQty'#9'10'#9'fQty'
      'fBeginTime'#9'34'#9'fBeginTime'
      'fEndTime'#9'34'#9'fEndTime'
      'fNotes'#9'200'#9'fNotes')
    IniAttributes.Delimiter = ';;'
    IniAttributes.UnicodeIniFile = False
    TitleColor = clBtnFace
    FixedCols = 0
    ShowHorzScrollBar = True
    Align = alBottom
    DataSource = dsBOM
    TabOrder = 1
    TitleAlignment = taLeftJustify
    TitleFont.Charset = DEFAULT_CHARSET
    TitleFont.Color = clWindowText
    TitleFont.Height = -11
    TitleFont.Name = 'Tahoma'
    TitleFont.Style = []
    TitleLines = 1
    TitleButtons = False
  end
  object ClothuConnection: TFDConnection
    Params.Strings = (
      'ConnectionDef=ClothU')
    Connected = True
    LoginPrompt = False
    Left = 435
    Top = 54
  end


  object TbomTable: TFDQuery
    Active = True
    Connection = ClothuConnection
    SQL.Strings = (
      'SELECT [fParentID]'
      '      ,[fPartID]'
      '      ,[fUnit]'
      '      ,[fQty]'
      '      ,[fBeginTime]'
      '      ,[fEndTime]'
      '      ,[fNotes]'
      '  FROM [ClothU].[base].[tBom]')
    Left = 331
    Top = 86
    object TbomTablesPartCode: TStringField
      DisplayWidth = 20
      FieldKind = fkLookup
      FieldName = 'sPartCode'   {计算字段}
      LookupDataSet = TproductTable
      LookupKeyFields = 'fID'
      LookupResultField = 'fCode'
      KeyFields = 'fPartID'
      Lookup = True
    end


    object TbomTablefPartID: TIntegerField
      DisplayWidth = 10
      FieldName = 'fPartID'
      Origin = 'fPartID'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object TbomTablefUnit: TWideStringField
      DisplayWidth = 50
      FieldName = 'fUnit'
      Origin = 'fUnit'
      Size = 50
    end
    object TbomTablefQty: TCurrencyField
      DisplayWidth = 10
      FieldName = 'fQty'
      Origin = 'fQty'
      Required = True
    end
    object TbomTablefBeginTime: TSQLTimeStampField
      DisplayWidth = 34
      FieldName = 'fBeginTime'
      Origin = 'fBeginTime'
    end
    object TbomTablefEndTime: TSQLTimeStampField
      DisplayWidth = 34
      FieldName = 'fEndTime'
      Origin = 'fEndTime'
    end
    object TbomTablefNotes: TWideStringField
      DisplayWidth = 200
      FieldName = 'fNotes'
      Origin = 'fNotes'
      Size = 200
    end
    object TbomTablefParentID: TIntegerField
      DisplayWidth = 10
      FieldName = 'fParentID'
      Origin = 'fParentID'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
      Visible = False
    end
  end
  object TproductTable: TFDQuery   {查找表}
    Active = True
    Connection = ClothuConnection
    SQL.Strings = (
      
        'Select fID,fCode,fName,fColor,fSpec,fUnitsName from base.vProduc' +
        't')
    Left = 436
    Top = 138
  end
  object dsBOM: TDataSource
    DataSet = TbomTable
    Left = 336
    Top = 152
  end
end

 

 

 

 

 

posted on 2020-12-19 15:58  癫狂编程  阅读(132)  评论(0编辑  收藏  举报

导航

好的代码像粥一样,都是用时间熬出来的