Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 10:09, 22 January 2008.

Create Marquee effect in poplists and menus

From Forum Nokia Wiki

Starting from S60 2nd Edition, FP2 it is possible to enable the marquee effect (horizontal scrolling of the selected item if its text width does not allow it to be fully displayed) for all the objects derived from CFormattedCellListBoxData.

void CTestAppUi::HandleCommandL( TInt aCommand )
  {
  switch( aCommand )
    {
    case ETestAppCommand1:
      {
 
      CAknSinglePopupMenuStyleListBox* list = new(ELeave) CAknSinglePopupMenuStyleListBox;
 
      CleanupStack::PushL(list);
 
      // Create popup list and PUSH it.
 
      CAknPopupList* popupList = CAknPopupList::NewL(list, R_AVKON_SOFTKEYS_OK_BACK, AknPopupLayouts::EMenuWindow);
 
      CleanupStack::PushL(popupList);    
 
      // initialize listbox.
 
      list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect);
 
      list->CreateScrollBarFrameL(ETrue);
 
      list->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
 
      _LIT(KListItemFormat, "%S");
 
      _LIT(KFirstItem, "First item");
 
      _LIT(KNextItem, "This is a very long string used for the next item");
 
      _LIT(KLastItem, "Last item");
 
      // construct listbox item array
 
      CDesCArray *itemList = new (ELeave) CDesCArrayFlat(3);
 
      TBuf<100> item;
 
      // first listbox item
 
      item.Format(KListItemFormat, &KFirstItem());
 
      itemList->AppendL(item);
 
      // next listbox item
 
      item.Format(KListItemFormat, &KNextItem());
 
      itemList->AppendL(item);
 
      // last listbox item
 
      item.Format(KListItemFormat, &KLastItem());
 
      itemList->AppendL(item);
 
      // set items and ownership
 
      list->Model()->SetItemTextArray(itemList);
 
      list->Model()->SetOwnershipType(ELbmOwnsItemArray);
 
      // enable marquee effect for long strings
 
      list->ItemDrawer()->FormattedCellData()->EnableMarqueeL( ETrue );
 
      // Set title
 
      popupList->SetTitleL(_L("Scrollable items"));    
 
      // Show popup list.
 
      CleanupStack::Pop();            // popuplist
 
      TBool popupOk = popupList->ExecuteLD();
 
      if(popupOk)
 
        {
 
        // do something
 
        }
 
      else
 
        {
 
        // do something else
 
        }
 
      CleanupStack::PopAndDestroy();  // list
 
      }
 
      break;
 
    default:
 
      Panic( ETestAppUi );
 
      break;
 
    }
 
  }
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZseriesE5f60Q
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX