Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Querying selection with list

From Wiki
Jump to: navigation, search
Article Metadata
Article
Created: symbianyucca (09 Apr 2007)
Last edited: hamishwillee (30 May 2013)
Reviewer Approved    Thumbs up icon sm.jpg

The CAknListQueryDialog API is designed for asking user to select options presented as a list. The following function shows how to use it:

TInt ShowQueryDialogL(CArrayPtr< CGulIcon >* aIcons,
CDesCArray* aSelectArrray, CArrayFixFlat<TInt>* aSelectedItems)
{
CAknListQueryDialog* dialog =
new(ELeave)CAknListQueryDialog(aSelectedItems);
dialog->PrepareLC(R_SELECTION_QUERY);
 
dialog->SetItemTextArray(aSelectArrray);
dialog->SetOwnershipType(ELbmDoesNotOwnItemArray);
 
dialog->SetIconArrayL(aIcons);
 
return dialog->RunLD();
}

The aIcons argument variable should be an icon array that includes two icons with masks. The first is for selected items and the second is for unselected items. The aSelectArray should have the text item array used with the listbox. The text strings also need to include the icon index and with two icons the index for text string icons should be 1. The aSelectedItems argument variable will hold indices of the selected items when finished.

Like all dialogs the CAknListQueryDialog also requires resource definition. This example function uses the following resource definition:

RESOURCE DIALOG r_selection_query
{
flags = EGeneralQueryFlags;
buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
items =
{
DLG_LINE
{
type = EAknCtListQueryControl;
id = EListQueryControl;
control = AVKON_LIST_QUERY_CONTROL
{
listtype = EAknCtSingleGraphicPopupMenuListBox;
listbox = LISTBOX
{
flags = EAknListBoxMultiselectionList;
height = 3;
width = 3;
};
heading = "Select";
};
}
};
}
This page was last modified on 30 May 2013, at 04:38.
55 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×