1
votes

I'm trying to make a custom ListBox that has more details and a link with LiveBindings. In bindlist I only see the standard fields: Text, Detail, Bitmap....

When trying to bind in the following code:

  Item := bliMS.FillExpressions.AddExpression;
  Item.ControlMemberName := 'SubTitle';
  Item.SourceMemberName := 'PAY_NAME';

An exception is raised:

Project xxxxxx raised exception class EEvaluatorError with message 'Couldn't find SubTitle'.

How can I add the SubTitle name to my custom ListBox?

1
Is your custom ListBox an object or a Class? I'd expect you would need to create a TMyListBox custom component, with a published SubTitle property and register.Frazz

1 Answers

0
votes

Your statement: Item.ControlMemberName := 'SubTitle'; won't work because there is no actual ControlMember / object / "field" in the ListBox/TList<ListViewItem> (actually, it's more correct to say that there is none in each of the ListBoxItem objects in the the Items TList actually) called 'SubTitle'.

Instead you have to use on of the built-in text objects (ControlMembers), of which, there are only 2:

  1. Item.Text
  2. Item.Detail

If you for some reason have to have a 'SubTitle' ControlMember, then you would need to create a custom ListBox or ListBoxItemAppearance object and register it.