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.

Posts: 169
Registered: ‎03-25-2011
My Device: Playbook, Z10 L.E.
My Carrier: Vodafone NL

Help creating a new component: ToggleActionItem

Hello there,


I want to add toggle buttons as items of a Context Menu. The idea is that the user must be able to turn some functionalities on and off via the context menu of a component.

Right now I managed to implement this behavior just using the default Cascades components: I place some ActionItem on a ActionSet of contextActions of my component. Once the ActionItem is triggered I set some toggled flags true/false and change its title and imageSource property to represent the toggled state. If the user toggles another ActionItem from the contextMenu that's supposed to be another toggle button, I un-toggle the current toggled item first. It works fine, but I wish I could keep the down state of the item - blue background and while letters - as the toggled state.

But now I want to re-use this functionalities in other components but I'm not sure how to achieve this.


My first idea is as follows:

  • Extend the bb::cascades::ActionSet class to be a ToggleActionSet. It would have a custom boolean property named allowMultipleSelection that if set to true, multiple items could be toggled at the same time, if set to false, only one item would be possible to be selected. It would also contain a function getSelectedItems() that would return a list of selected indexes.
  • Extend the bb:cascades:ActionItem class to be a ToggleActionItem. It would contain one custom boolean property named toggledIt would contain the logic for rendering the toggled state (UI).
  • A bunch of signals and other functions are planned but I didn't put here just save some time.

What do you guys think? Do you think these two extended classes is the way to go?


I also checked the class bb::cascades::ImageToggleButton, which has a lot of the functionalities that I need, but it's not based on bb::cascades::AbstractActionItem so it's possible to put it in an ActionSet. The class bb::cascades::MultiSelectActionItem was also promising but I think it's meant to be used with something else, more complex than what I need.


Looking forward to your suggestions.