You Are Here:

Community: Wiki

This page was last modified on 29 September 2009, at 12:33.

Querying selection with list

From Forum Nokia Wiki

Reviewer Approved   

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";
};
}
};
}

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
User Rating: qfnZuserE5FratingQNx5E2E0000X