前段时间做东西用到的,截图是UC桌面的,实现之后效果和他的一样 系统的列表查询对话框 code: 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->EnableFind(); // popuplist TBool popupOk = popupList->ExecuteLD(); if(popupOk) { // do something } else { // do something else } CleanupStack::PopAndDestroy(); // list |