Languages

Menu
Sites
Language
Two Listviews in a form

Hi,

  I have to use searchBar in my form which is already have a listview.

 To use searchbar we have an example in samples.

 But in that one GroupedListView and normal ListView.

 Now I have one ListView. and i have to add another listview for searched items.

Is it possible to use two listviews in a form.

How to implement event listeners differently for two listviews.

can u explain me with some sample code.

 

Thanks

Rajyalakshmi

 

Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

2 Replies
wil smith
AFAIK, you can have multiple listviews as well, you need to ensure they are not overlapping each other. For better mangeabilty, use separate event handlers and item providers.
Alex Dem
Hi, If you want expand your Form with second ListView I could propose next solution: 1. try to create addditional class for second ListView and reimplement methods of IListViewItemProvider and IListViewItemEventListener there. class baseForm; class List2Listeners : public Tizen::Ui::Controls::IListViewItemEventListener , public Tizen::Ui::Controls::IListViewItemProvider { public: List2Listeners(baseForm* pointer) { pForm=pointer; } virtual void OnListViewContextItemStateChanged(Tizen::Ui::Controls::ListView &listView, int index, int elementId, Tizen::Ui::Controls::ListContextItemStatus state); virtual void OnListViewItemStateChanged(Tizen::Ui::Controls::ListView &listView, int index, int elementId, Tizen::Ui::Controls::ListItemStatus status); virtual void OnListViewItemSwept(Tizen::Ui::Controls::ListView &listView, int index, Tizen::Ui::Controls::SweepDirection direction); virtual Tizen::Ui::Controls::ListItemBase* CreateItem(int index, int itemWidth); virtual bool DeleteItem(int index, Tizen::Ui::Controls::ListItemBase* pItem, int itemWidth); virtual int GetItemCount(void); baseForm* pForm; }; Implement these methods. 2. add pointer List2Listeners* __pList2Listeners inside your Form class. 3. try to create second ListView in your baseForm::Initialize() or somewhere else: __pList2Listeners= new List2Listeners(this); __pListView2 = new ListView(); __pListView2->Construct(Rectangle(0, 70, 720, 700), true, false); __pListView2->AddListViewItemEventListener(*__pList2Listeners); __pListView2->SetItemProvider(*__pList2Listeners); AddControl(__pListView2); You will have pointer to your baseForm inside listeners of second ListView, you will able to use its public methods and data. Alexey.