qnx.fuse.ui.core.MultiSelectAction

MultiSelectAction

Properties | Methods | Events | Examples


Packageqnx.fuse.ui.core
Classpublic class MultiSelectAction
InheritanceMultiSelectAction Inheritance ActionBase Inheritance flash.events.EventDispatcher

MultiSelectActions are Actions used for Multi-Select functionality in the context menu.

A MultiSelectAction will appear as the last action before a DeleteAction, should one exist. Only one MultiSelectAction can be on the Context Menu at a time.



Class information:
BlackBerry 10 Version:   10.0.0

View the examples



Public Properties

 PropertyDefined By
 Inheriteddata : Object
The data associated with the action.
ActionBase
 Inheritedenabled : Boolean
Enables or disables the Action.
ActionBase
 Inheritedicon : Object
An optional icon that is shown next to the label text.
ActionBase
 InheritedkeyboardShortcut : Array
An array of keys that can be pressed to trigger this action.
ActionBase
 Inheritedlabel : String
The text that appears when this action is displayed in a UI component.
ActionBase

Public Methods

 MethodDefined By
  
MultiSelectAction(label:String = null, icon:Object = null, data:Object = null, keyboardShortcut:Array = null)
Creates a new MultiSelectAction instance.
MultiSelectAction

Events

 Event Summary Defined By
 InheritedDispatched when one of the properties on the Action is modified.ActionBase

Constructor Detail

MultiSelectAction()


public function MultiSelectAction(label:String = null, icon:Object = null, data:Object = null, keyboardShortcut:Array = null)

Creates a new MultiSelectAction instance.

Parameters

label:String (default = null) — A label for the Action to be shown whenever an Action is shown in components like the ActionBar or CrossCut menu.
icon:Object (default = null) — A DisplayObject, a String as a URL to an external image, a Bitmap instance, or a BitmapData instance.
data:Object (default = null) — Data to be associated with the TabAction. Use this parameter to maintain useful data associated with the TabAction.
keyboardShortcut:Array (default = null) — An array of keys that can be pressed to trigger this action. Valid keys can be found in the flash.ui.Keyboard class.

Examples

In the following example a new List is created which when one of its elements is long pressed, a context menu appears with two actions and a MultiSelectAction. If the MultiSelectAction is chosen, the context menu goes in to multi select mode where the number of selected items in the list are displayed in a bar across the bottom of the screen.
package
{
    import qnx.fuse.ui.core.Action;
    import qnx.fuse.ui.core.ActionBase;
    import qnx.fuse.ui.core.ActionSet;
    import qnx.fuse.ui.core.MultiSelectAction;
    import qnx.fuse.ui.events.ListEvent;
    import qnx.fuse.ui.listClasses.List;
    import qnx.fuse.ui.listClasses.ListSelectionMode;
    import qnx.ui.data.DataProvider;
    import flash.display.Sprite;

    public class MultiSelectExample extends Sprite
    {
        private var _list : List;
        
        public function MultiSelectExample()
        {
            initializeUI();
        }

        private function initializeUI() : void
        {
            var a1:Action = new Action("Option 1");
            var a2:Action = new Action("Option 2");
            var a3:MultiSelectAction = new MultiSelectAction("MultiSelect");
            var actionSet:ActionSet = new ActionSet(new <ActionBase>[a1, a2], "MultiSelect CrossCut", null, null, a3);
            
            _list = new List();
            _list.selectionMode = ListSelectionMode.MULTIPLE;
            _list.dataProvider = new DataProvider([{label:"item 1"}, {label:"item 2"}, {label:"item 3"}]);
            _list.contextActions = new <ActionSet>[actionSet];
            _list.addEventListener( ListEvent.ITEM_CLICKED, onItemClicked );
            addChild(_list);
        }

        private function onItemClicked (event : ListEvent) : void
        {
            _list.contextMultiSelectText = _list.selectedIndices.length + " Item(s) Selected";
        }
    }
}
     




comments powered by Disqus