×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    10

    Lists instead of menus

    I’m can’t find out how to display a list in series 60.

    From the S60_UI_StyleGuide.pdf it appears that menus and lists are both a kind of dialog. In fact menus are called menu lists.

    How to make a menu list for the options key is fairly clear: Declare commands in MENI_ITEMs, in a hierarchy of MENU_PANE, MENU_TITLE, and MENU_BAR in a resource EIK_APP_INFO.

    Cursor movement is taken care of, as is firing HandleCommandL() if the user presses select. Instead of a command you can cascade to another MENU_PANE for MENU_ITEMS.

    A list is a little different. It seems to be built using a dialog. The text displayed to the user comes from a database, instead of being displayed from a static MENU_ITEM. In fact the number of items is variable in a list.

    Examples are contacts, phonebook, or a directory of files. The arrow keys move the focus from item to item, but if you press select, the same command each time will be passed to HandleCommandL().

    I can’t find any documentation on lists, other than the style guide, and no examples.

    I actually want to construct a 2 line style 1 list as defined in the style guide.

    Where can I found out how, or how do I do it ?

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    Czech Republic
    Posts
    915
    Hi irishbeast,
    I don't really see what's your point, but if you want some more information about listboxes just look at \series60\series60Ex\listbox example in SDK and / or CEikListbox class in SDK help

  3. #3
    Registered User
    Join Date
    Aug 2004
    Posts
    10

    How to use the model

    Hi Sopta,

    I've looked through listbox, and all the example used static date defined in resources.

    I've seen no examples where the list data is got from somewhere, instead its simply defined in a resource.

  4. #4
    Super Contributor
    Join Date
    Apr 2003
    Location
    Czech Republic
    Posts
    915
    ok, try something like this (it is ripped of some application so maybe is something missing, but you should get the general idea)
    Code:
    //1, Specify the type (controller class) of the listbox:
    iListBox = new (ELeave) CAknSingleStyleListBox();
    
    //2, Create the listbox. 
    iListBox->SetContainerWindowL(*this);
    iListBox->ConstructL(this, EAknListBoxSelectionList);
    
    //3, Set the scolls 
    iListBox->CreateScrollBarFrameL(ETrue);
    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
    
    //3.5, Create list of icons
    CArrayPtr<CGulIcon>* iconList = new (ELeave) CAknIconArray(10);
    CleanupStack::PushL(iconList);
    
    // Icons are referenced by their physical position in .mbm file
    iconList->AppendL(iEikonEnv->CreateIconL(pApp->MbmPathL(), 11, 12));
    iconList->AppendL(iEikonEnv->CreateIconL(pApp->MbmPathL(), 13, 14));
    iconList->AppendL(iEikonEnv->CreateIconL(pApp->MbmPathL(), 15, 16));
    iconList->AppendL(iEikonEnv->CreateIconL(pApp->MbmPathL(), 17, 18));
    iconList->AppendL(iEikonEnv->CreateIconL(pApp->MbmPathL(), 19, 20));
    
    CleanupStack::Pop();
    
    // assign icon list to a listbox...
    iListBox->ItemDrawer()->FormattedCellData()->SetIconArray(iconList);
    
    //4, Fill the items: (listbox model)
    CDesCArrayFlat* array = new (ELeave) CDesCArrayFlat(1);
    
    array->AppendL(_L("0\tItem1"));
    array->AppendL(_L("1\tItem2"));
    array->AppendL(_L("2\tItem3"));
    array->AppendL(_L("3\tItem4"));
    
    iListBox->Model()->SetItemTextArray(array);
    
    //5, Set the size
    iListBox->SetRect(Rect());
    
    //6, Set the key handling 
    iAvkonAppUi->AddToStackL(iListBox);
    
    //7, Activate the listbox
    iListBox->ActivateL();

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×