Delphi XE5 で FMX メトロポリス アプリケーションをコーディングしていたところ、データソースと TListBox の同期でエラーが発生しました。1 つまたは複数の項目を結合するグループ ヘッダーが存在するまでは、適切に機能します。ListBox
グループ内の( ListItemStyle
= )の最初のアイテムを選択するとMetropolisUI
、リストから消えます (見えなくなりますが、これはデータセット自体には影響しません)。
object LinkListControlToField1: TLinkListControlToField
Category = 'Quick Bindings'
DataSource = BindSourceDB1
FieldName = 'name2'
Control = ListBox1
FillExpressions = <
item
SourceMemberName = 'photo_mini'
ControlMemberName = 'Icon'
end
item
SourceMemberName = 'diagnosis_short'
ControlMemberName = 'Description'
end
item
ControlMemberName = 'Title'
CustomFormat = 'self.owner.name1.text+" "+self.owner.name2.text'
end>
ListItemStyle = 'MetropolisUI'
AutoBufferCount = False
FillHeaderExpressions = <>
FillBreakFieldName = 'ward'
FillHeaderCustomFormat = '"Ward "+ward.text'
FillBreakGroups = <>
end
end
エラーを再現するために使用した次の単純化されたプロジェクトは、別の方法で動作していますが、問題の問題はほとんど同じです。PrototypeBindSource1: TPrototypeBindSource;
(リテラル フィールドと整数フィールドを生成する) フォームのみが必要です。LiveBindings のリンクは次BindingsList1: TBindingsList; ListBox1: TListBox;
のEdit1: TEdit;
とおりです。
object BindingsList1: TBindingsList
Methods = <>
OutputConverters = <>
Left = 20
Top = 5
object LinkListControlToField1: TLinkListControlToField
Category = 'Quick Bindings'
DataSource = PrototypeBindSource1
FieldName = 'ContactName1'
Control = ListBox1
FillExpressions = <>
AutoBufferCount = False
FillHeaderExpressions = <>
FillHeaderFieldName = 'UIntField1'
FillBreakGroups = <>
end
object LinkControlToField1: TLinkControlToField
Category = 'Quick Bindings'
DataSource = PrototypeBindSource1
FieldName = 'ContactName1'
Control = Edit1
Track = False
end
項目の選択が、DataSource (DataSet) で選択されたレコードの ID に対応していません。LiveBindings エンジンは、選択したレコードの実体ではなく、のItemIndex
プロパティを同期しているようです。問題を解決する正しい方法はありますか?TListBox
id