LookupCombobox doesn't work

Issue #9 resolved
Former user created an issue

I am looking for an Lookup-Combobox. So I try to bind a TCombobox (csDropDownList) to a Class:

type TSample = class
..
property Code:string
property Description:string
end;

cb.View.ItemsSource:=SampleList as IList;
cb.View.ItemTemplate:=TColumnDataTemplate.Create(['Description']);

Now I suspect to get the current selected TSample-object in cb.View.CurrentItem. But there is NIL.

If I try the same with TListbox all is working. So I can get the 'Code' from the selected Description.

Comments (3)

  1. Stefan Glienke repo owner

    Did you declare your TSample class in the implementation part? In that case it is missing some RTTI and it does not work (more precisely because it is missing the QualifiedName).

    You need to move that to the interface part and it will work.

  2. Former user Account Deleted

    I have declared it in interface part.

    If I use a TListbox all works right. I changed only

    cb.View.ItemsSource:=SampleList as IList;
    cb.View.ItemTemplate:=TColumnDataTemplate.Create(['Description']);
    

    to

    lst.View.ItemsSource:=SampleList as IList;
    lst.View.ItemTemplate:=TColumnDataTemplate.Create(['Description']);
    

    and I have a TSample-object in lst.View.CurrentItem

    but not if I use TCombobox with Style csDropDownList

  3. Log in to comment