Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 52
Registered: ‎04-22-2012
My Device: Z10
My Carrier: Mobilicity
Accepted Solution

Preventing ListView item selection during multi select

How do you prevent a user from selecting specific items during a multi select. Can you use the MultiSelectHandler to do this ?

 

I have basically two types of items. Cached and Uncached.  When the user is performing a Multi Select on a Cached item.. I only want them selecting other Cached items.  Likewise if the user is performing a Multi Select on an Uncached item.. I only want them selecting other Uncached items.  

 

Is there anyway to do this?  Been googling for half an hour and cant find anything related to this use case. 

Developer
Posts: 52
Registered: ‎04-22-2012
My Device: Z10
My Carrier: Mobilicity

Re: Preventing ListView item selection during multi select

bump

Developer
Posts: 52
Registered: ‎04-22-2012
My Device: Z10
My Carrier: Mobilicity

Re: Preventing ListView item selection during multi select

bump.

 

Just trying to figure out if its possible to prevent selection (during multiple select phase) of specific ListView items or ListItemComponents. 

Developer
Posts: 52
Registered: ‎04-22-2012
My Device: Z10
My Carrier: Mobilicity

Re: Preventing ListView item selection during multi select

up

Developer
Posts: 52
Registered: ‎04-22-2012
My Device: Z10
My Carrier: Mobilicity

Re: Preventing ListView item selection during multi select

back to the top

Highlighted
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Preventing ListView item selection during multi select

In the onTriggered() slot of the ActionItem you are able to read the currently selected items using selectionList() then determine whether you want to clear the item or not dependent on your grouping rules.


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 52
Registered: ‎04-22-2012
My Device: Z10
My Carrier: Mobilicity

Re: Preventing ListView item selection during multi select

Since I use a custom list item I went about this a bit differently. My CustomListItem implements a ListItemListener. I implemented the select method as such. 

 

 

void CustomStandardListItem::select(bool select) {
	bb::cascades::ListItemListener* lil = static_cast<bb::cascades::StandardListItem*>(m_sli);
	bb::cascades::ListView * view = qobject_cast<bb::cascades::ListView*>(this->parent());

	if (view->multiSelectHandler()->isActive()) {
		bool isCached = view->property("isMultiSelectTypeCached").toBool();

		if (m_cachedImageView->isVisible() && isCached) { // is cached.. allow selection of other cached objects only
			lil->select(select);
		}
		else if (!m_cachedImageView->isVisible() && !isCached) { // is not cached.. allow selection other cached objects only
			lil->select(select);
		}
	}
	else {
		lil->select(select);
	}
}

 

 The dynamic property "isMultiSelectTypeCached" is just a bool on the ListView that gets set based on the type of ListItemComponent. This could just have been the ListItemComponent type as well.