Use of tags in cakncolumnlistbox

Source: Internet
Author: User

The use of tags in cakncolumnlistbox is quite common. It is mainly used when multiple items are selected at the same time. Its main implementation steps are as follows:

1. Construction

Isavedgameslistbox-> constructl (this, eaknlistboxmarkablelist );

Use the eaknlistboxmarkablelist flag

2. Mark, unmark, mark all, and cancel all functions

case EAknCmdMark:case EAknCmdUnmark:case EAknMarkAll:case EAknUnmarkAll:{iAppContainer->HandleMarkCommandL (aCommand);break;}void CMarkableListContainer::HandleMarkCommandL(TInt aCommand){if (iSavedGamesListBox){AknSelectionService::HandleMarkableListProcessCommandL (aCommand, iSavedGamesListBox);}}

It can also be implemented using another method:

void CMarkableListContainer::HandleMarkL(){TInt index=iSavedGamesListBox->CurrentItemIndex();if(index<0)return;iSavedGamesListBox->View()->SelectItemL(index);}void CMarkableListContainer::HandleUnMarkL(){TInt index=iSavedGamesListBox->CurrentItemIndex();if(index<0)return;iSavedGamesListBox->View()->DeselectItem(index);}void CMarkableListContainer::HandleMarkAllL(){CTextListBoxModel* model = iSavedGamesListBox->Model();TInt itemCount = model->NumberOfItems();CListBoxView* listBoxView = iSavedGamesListBox->View();for (TUint i = 0; i < itemCount; i++){listBoxView->SelectItemL(i);}}void CMarkableListContainer::HandleUnMarkAllL(){CTextListBoxModel* model = iSavedGamesListBox->Model();TInt itemCount = model->NumberOfItems();CListBoxView* listBoxView = iSavedGamesListBox->View();for (TUint i = 0; i < itemCount; i++){listBoxView->DeselectItem(i);}}

 

Implementation of the reverse mark function:

void CMarkableListContainer::HandleMarkCommandOthersL(){CTextListBoxModel* model = iSavedGamesListBox->Model();TInt itemCount = model->NumberOfItems();CListBoxView* listBoxView = iSavedGamesListBox->View();for (TUint i = 0; i < itemCount; i++){if(listBoxView->ItemIsSelected(i)){listBoxView->DeselectItem(i);}else{listBoxView->SelectItemL(i);}}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.