How can I filter items in a Listbox?

Login to reply to this topic.
Thu, 2005-06-23 14:09
Joined: 2004-07-01
Forum posts: 13
Hi All! I am trying to make a ListBox with a FindBox. I find only one useful class: CCknSearchField. I know how can I make and use a Findbox  in Series60, but in Series80 I can not find equivalence classes for these:

AknFind::HandleFindOfferKeyEventL

CAknListBoxFilterItems -> No direct mapping.

CAknFilteredTextListBoxModel -> No direct mapping.

Please help.

Regards,
RadeaR

Wed, 2005-07-06 15:15
Joined: 2004-12-03
Forum posts: 192
Re: How can I filter items in a Listbox?
use CEikTextListBox

Code:
CDesCArray *theArray = static_cast<CDesCArray *>(theListBox->Model()->ItemTextArray());
theArray->Sort();
theListBox->HandleItemAdditionL();
where theListBox is an object of CEikTextListBox-class
Thu, 2005-09-15 14:10
Joined: 2005-09-15
Forum posts: 2
Re: How can I filter items in a Listbox?
Hello

You can use the following code snippet to get the original unfiltered index from a list in series 80

TInt index = iList->CurrentItemIndex();
// this gives the index of the filtered list
CTextListBoxModel *model = iList->Model();
TPtrC displayedData = model->ItemText(index);

//to get the original index
MDesCArray *elements = model->ItemTextArray();
CDesCArray *itemArray = STATIC_CAST( CDesCArray*, elements );
TInt originalIndex;

itemArray->Find(displayedData, originalIndex);
return originalIndex;

originalIndex gives the unfiltered index of the currently selected item in the filtered list

Njoy !!
 
As for direct mapping for AknFind::HandleFindOfferKeyEventL,
you can use iSearchField->OfferKeyEventL()

Smiley
  • Login to reply to this topic.