TwwDBGrid + TwwDBLookupCombo 下拉列表

 目标标求:点击TwwDBGrid中的sPartCode字段弹出下拉列表

平台 :DELPHI 10.3 +INFO POWER 4K 20.0+  WIN7 64

大致步骤  :

  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   癫狂编程  阅读(166)  评论(0编辑  收藏  举报

编辑推荐:
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
阅读排行:
· 全网最简单!3分钟用满血DeepSeek R1开发一款AI智能客服,零代码轻松接入微信、公众号、小程
· .NET 10 首个预览版发布,跨平台开发与性能全面提升
· 《HelloGitHub》第 107 期
· 全程使用 AI 从 0 到 1 写了个小工具
· 从文本到图像:SSE 如何助力 AI 内容实时呈现?(Typescript篇)

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
好的代码像粥一样,都是用时间熬出来的
点击右上角即可分享
微信分享提示