You Are Here:

Community: Blogs

Open Source Bluetooth PAN's Forum Nokia Blog

Insert Multiselection list into GUI

Carbider | 06 November, 2007 11:09

One of my favorite classes that Symbian grants to build User Interface is Multiselection List. I’ve learned about it recently.

This is a type of Vertical lists which draws a set of elements each of them can be marked by checkbox.

 

At future BluSPAN GUI there is “Chat settings” view. User can determine which types of files can be accepted by chat. Example: .bmp, .jpeg, .avi, .mpeg,  wav and so on. See diagram 1.

 

 

 

Diagram 1 – Multiselection list at Chat settings view.

 

To build Multiselection List into my application I had to read about a lot of stages how to use it.

I divided this stages to:

» Defining Multiselection List in resource (.rss) file

» Code implementation in source (.cpp) to Popup it.

» Get results of user choice.

 

1. Defining Multiselection List in .rss file

 

I’ve read the Resources_Dialogs.pdf at S60_Platform_Avkon_UI_Resources documentation series. Upon this I’ve formed the resource definition as below:

Listing 1

// Multiselection list query dialog

RESOURCE DIALOG r_accept_type_multiselection_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;

   array_id = r_accept_types_multiselection_query_list_item;

   };

   heading = "Select types:";

   };

   }

   };

}

RESOURCE ARRAY r_accept_types_multiselection_query_list_item

{

   items =

   {

   LBUF { txt = "1t.Bmp"; },

   LBUF { txt = "1t.Jpg"; },

   LBUF { txt = "1t.Avi"; },

   LBUF { txt = "1t.Mp3"; },

   LBUF { txt = "1t.Wav"; }

   };

}

I have put this listing  to [project_name].rss  file. After that you can call ExecuteLD() function with Reference to this resource object. This will be shown below.

2. Popuping list. Code implementation.

With UI designer help, choose the Event tab for “Accept types” menu item. Double click on event to generate Handler function.

In this function we need to create an Instance of CAknListQueryDialog class and Execute it. The source code below shows it.

 

Listing 2

// Run a dialog of “Acceptance of data types”

CArrayFixFlat<TInt>* indexArray = new(ELeave)CArrayFixFlat<TInt>(5);

CleanupStack::PushL(indexArray);

CAknListQueryDialog* dlg = new (ELeave)

CAknListQueryDialog(indexArray);

              

if ( dlg->ExecuteLD(R_ACCEPT_TYPE_MULTISELECTION_QUERY ) )

{

    Here we will take results of User’s choice

}

CleanupStack::PopAndDestroy();// indexArray

By this code the Multiselection List will Popup and user can mark preferable items.

3. Geting results of user choice

That task was not easy due to Specific Array type of CArrayFixFlat<TInt>. I could not retrieve data from it. I found a way with help of the similar topic of this forum.

The source code below should be placed at Listing 2 to the “if ( dlg->ExecuteLD)” branch. This source code takes result from List and shows indexes of selected items on screen (diagram 2).

Listing 3

if ( dlg->ExecuteLD(R_ACCEPT_TYPE_MULTISELECTION_QUERY ) )

{

TBufC<136> resultString;

TPtr ptr = resultString.Des();

                         

//temporary string to convert from TInt to text

TBufC<136> temporaryString;

TPtr ptrTemporaryString = temporaryString.Des();

TInt intValue;

                         

//How much elements did user select from Multiselection list

TInt elementsAmount = indexArray->Count();

                         

//Retrieve all element that user have picked up

for (TInt elementI = 0; elementI < elementsAmount; elementI++) {

intValue = (*indexArray)[elementI];

ptrTemporaryString.Format(_L("%d "), intValue);

ptr.Append(temporaryString);

}

                         

//Show the elements user have picked up

CAknInformationNote* Notelnformation;

Notelnformation = new (ELeave) CAknInformationNote;

Notelnformation ->ExecuteLD(resultString);

} // If

 

Diagram 2 – Results of user’s choice. Indexes of selected items

Download source code here: guiSetBluspan Zip Archive v 0.002 (Nokia’s wiki)

See this posts here to know how to use sources.

 

 
 

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 
RDF Facets: qdcZdescriptionQSxItE20allE20startedE20innocentlyE20enoughE2eE20TheE20notebookE20didnE27tE20fitE20inE20myE20pocketE2cE20andE20myE20N93E20wasE20alreadyE20thereE2eE20ItE92sE20beenE20aE20greatE20coupleE20ofE20weeksE2cE20butE20IE92mE20gladE20toE20beE20backE2eE20NareshE20E2cE20ToteE20andE20E52onE20haveE20alreadyE20commentedE20onE20theE20ChampionE20E44ayE2eE20IE20echoE20theirE20thoughtsE20thatE20itE20isE20wonderfulE20toE20meetE20inE203E44E2dlandE20thoseE20peopleE20whoE20IE20workE20withE20andE20workE20forE2cE20butE20rarelyE20actuallyE20seeE2eE20Ea0E20AfterE2eE2eE2eE20E45ventE2cE20GeneralE20IE92veE20beenE20workingE20onE20myE20ToE44oE20listE20thisE20weekE2eE20WellE2cE20workingE20mightE20beE20aE20stretchE2eE20ItE92sE20beeE2eE2eE2eX qdcZidentifierQSxhttpE3aE2fE2fblogsE2eforumE2enokiaE2ecomE2fblogE2ftastyE2dmultimediaE2djournalsE2dforumE2dnokiaE2dblogE2fgeneralX qdcZpublisherQUxhttpE3aE2fE2fswE2enokiaE2ecomE2fidE2fc764fd1cE2d8b06E2d499aE2d9a6aE2d17c3903d5a65E2fforumE5fnokiaE5fcrawlerE5fagentX qdcZtitleQSxTastyE20MultimediaE20JournalE27sE20ForumE20NokiaE20BlogE20E7cE20GeneralX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZBlogContentQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qrssZdescriptionQSxItE20allE20startedE20innocentlyE20enoughE2eE20TheE20notebookE20didnE27tE20fitE20inE20myE20pocketE2cE20andE20myE20N93E20wasE20alreadyE20thereE2eE20ItE92sE20beenE20aE20greatE20coupleE20ofE20weeksE2cE20butE20IE92mE20gladE20toE20beE20backE2eE20NareshE20E2cE20ToteE20andE20E52onE20haveE20alreadyE20commentedE20onE20theE20ChampionE20E44ayE2eE20IE20echoE20theirE20thoughtsE20thatE20itE20isE20wonderfulE20toE20meetE20inE203E44E2dlandE20thoseE20peopleE20whoE20IE20workE20withE20andE20workE20forE2cE20butE20rarelyE20actuallyE20seeE2eE20Ea0E20AfterE2eE2eE2eE20E45ventE2cE20GeneralE20IE92veE20beenE20workingE20onE20myE20ToE44oE20listE20thisE20weekE2eE20WellE2cE20workingE20mightE20beE20aE20stretchE2eE20ItE92sE20beeE2eE2eE2eX qfnZdistributionQUxhttpE3aE2fE2fblogsE2eforumE2enokiaE2ecomE2fX qfnZtypeQUqfntypeZBlogContentQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZupdatedQDx2008E2d10E2d03X qmarsZdescriptionQSxItE20allE20startedE20innocentlyE20enoughE2eE20TheE20notebookE20didnE27tE20fitE20inE20myE20pocketE2cE20andE20myE20N93E20wasE20alreadyE20thereE2eE20ItE92sE20beenE20aE20greatE20coupleE20ofE20weeksE2cE20butE20IE92mE20gladE20toE20beE20backE2eE20NareshE20E2cE20ToteE20andE20E52onE20haveE20alreadyE20commentedE20onE20theE20ChampionE20E44ayE2eE20IE20echoE20theirE20thoughtsE20thatE20itE20isE20wonderfulE20toE20meetE20inE203E44E2dlandE20thoseE20peopleE20whoE20IE20workE20withE20andE20workE20forE2cE20butE20rarelyE20actuallyE20seeE2eE20Ea0E20AfterE2eE2eE2eE20E45ventE2cE20GeneralE20IE92veE20beenE20workingE20onE20myE20ToE44oE20listE20thisE20weekE2eE20WellE2cE20workingE20mightE20beE20aE20stretchE2eE20ItE92sE20beeE2eE2eE2eX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZBlogContentQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ