View a printable version of the current page.
  Wiki > Symbian Developer Network Public Wiki > ... > SDN Wiki Competition 2007 entries > Using Listquery dialog
  Using Listquery dialog
Added by eswar_illuri, last edited by Rodney De Gale on Feb 15, 2008  (view change)
Labels: 
(None)

Introduction

List Query Dialogs contains menu list, from which user can select one or more items. Items in the list can contain one or two line of text and with or without icon or heading. And with lists, all the items must have the same content type. The resource type for a list query is AVKON_LIST_QUERY, it contains single dialog line AVKON_LIST_QUERY_DLG_LINE containing an AVKON_LIST_QUERY_CONTROL. The control should define the listtype field to indicate the type of list the query will contain. This could be one of the pop-up menu list types, but in ListQuery a single line of text is chosen. The listbox refers to an AVKON_LIST_QUERY_LIST resource. To define the list items statically, an array identifier can be specified. The array_id specified in the AVKON_LIST_QUERY_LIST resource structure can refer to another resource containing an array of static strings representing the list items.

RESOURCE AVKON_LIST_QUERY r_update_query_dialog
{
   flags = EGeneralQueryFlags;
   softkeys = R_AVKON_SOFTKEYS_OK_CANCEL;
   items =
   {
      AVKON_LIST_QUERY_DLG_LINE
      {
         control = AVKON_LIST_QUERY_CONTROL
         {
            listtype = EAknCtSinglePopupMenuListBox;
            listbox = AVKON_LIST_QUERY_LIST
            {
            };
            heading = "Select Option";
         };
      }
   };
}

How to Execute List Query Dialog

Initially List Query Dialog class constructor takes reference to a TInt. It represents the index of the selected item and can be set to a nonzero value to preselect a particular item in the list. The TInt passed in is updated by the control with the user selection.

TInt selectedOption( 0 );

CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(10);
CleanupStack::PushL(array);

TBuf<10> palabra;
for (TInt num= 0; num< 10; num++)
{
   palabra.Format(_L("option %d"), num);
   array->AppendL(palabra);
}

CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog( &selectedOption );
dlg->PrepareLC(R_UPDATE_QUERY_DIALOG);
dlg->SetItemTextArray(array);
dlg->SetOwnershipType(ELbmDoesNotOwnItemArray);
dlg->RunLD();

CleanupStack::PopAndDestroy(); //array
[live-web] Interactive Services Terms & Conditions of use | Terms of use | Privacy policy | Media Center | Contact us | © 2008 Symbian