2

FMX Metropolis UI アプリケーションをコーディングし、文字列型の 2 つのフィールド値を、LiveBindings テクノロジ (式エンジンを使用) によって TListBox の Item.Title メンバーに割り当てようとしています。

TBindList を次のように使用すると:

object BindList1: TBindList
  Category = 'Lists'
  ControlComponent = ListBox1
  SourceComponent = BindSourceDB1
  FormatExpressions = <
    item
      ControlExpression = 'Text'
      SourceExpression =
        'FieldByName("name1").Text + " " + Field' +
        'ByName("name2").Text'
    end>
  FormatControlExpressions = <>
  ClearControlExpressions = <>
end 

「name1 name2」文字列をメンバーに割り当てますが、TBindList クラスにそのようなプロパティがないTextため、設定に失敗しますListItemStyle := MetropolisUI

私が使用する場合TLinkFillControlToField

object LinkFillControlToField2: TLinkFillControlToField
      Category = 'Quick Bindings'
      Control = ListBox1
      Track = True
      FillDataSource = BindSourceDB1
      FillDisplayFieldName = 'name1'
      AutoFill = True
      BufferCount = -1
      AutoBufferCount = False
      FillExpressions = <>
      FillHeaderExpressions = <>
      FillBreakGroups = <>
    end

に割り当てることListItemStyleができますが、プロパティでMetropolisUIアクセスできるフィールドは 1 つだけで、それに割り当てるフィールドはありません。FillDisplayFieldNameSourceExpression'FieldByName("name1").Text + " " + FieldByName("name2").Text'

I tried to guess context of Item.Text member of TListBox from TBindList but I did not manage to. I studied Delphi samples but there is no Metropolis TListBox and it seems to act in a different way than the common one. Does anybody have any ideas how to find the solution for this issue?

4

1 に答える 1

2

@ house -of- dexterの投稿に感謝しTLabelますTLinkFillControlToField。主な問題は、フィールド名のコンテキストが で見つかることですSelf.Owner

object LinkFillControlToField2: TLinkFillControlToField
  Category = 'Quick Bindings'
  DataSource = BindSourceDB1
  Control = ListBox1
  Track = True
  FillDataSource = BindSourceDB1
  AutoFill = True
  BufferCount = -1
  AutoBufferCount = False
  ListItemStyle = 'MetropolisUI'
  FillExpressions = <
    item
      SourceMemberName = 'name1'
      ControlMemberName = 'Title'
      CustomFormat = 'Self.Owner.name1.text+" "+Self.Owner.name2.text'
    end>
  FillHeaderExpressions = <>
  FillBreakGroups = <>
end
于 2015-07-03T12:46:22.440 に答える