For more information, see the API reference on how you can:
Create multiple selection listboxes
Figure: Multiple selection lists
Figure: Markable list
If MSK’s command id is set to either EAknSoftkeyMark
or EAknSoftkeyUnmark
when
the list is activated, MSK is automatically set to Mark or Unmark depending
on the list item’s selection state.
When focus is changed, MSK automatically changes between Mark / Unmark depending on the list item’s selection. An application can override this feature by, for example, using its own (application-specific) command ids for Mark and Unmark.
By default markable list creates an additional MSK observer, which handles mark, unmark and shift+MSK events.
These events (except for shift+MSK) are also passed to the default softkey handler (application).
This additional MSK observer is the only place that gets
the shift+MSK softkey event (EAknSoftkeyShiftMSK
).
Additional MSK observer for markable lists can be enabled or disabled by calling (in CEikListBox):
IMPORT_C void EnableMSKObserver(TBool aEnable);
After disabling additional MSK observer in list side, the application can register its own additional MSK observer for shift+MSK handling by calling CEikCba's method SetMSKCommandObserver:
CEikButtonGroupContainer *bgc = MyAppCurrentButtonGroup(); CEikCba* cba; cba= (static_cast<CEikCba*>(bgc->ButtonGroup())); //downcast from MEikButtonGroup cba->SetMSKCommandObserver( iApplicationsCbaHandler ); }
After this, iApplicationsCbaHandler
receives EAknSoftkeyShiftMSK
whenever
the user presses shift+MSK.
Specified functionality for markable lists (shift, ctrl and hash key marking) is that when a user presses the “marking” key, MSK changes (after a little timeout) to Mark / Unmark and then marking works as before. When the user releases the “marking” key (or list loses focus), the old MSK is restored. This functionality is coded in Avkon, but it requires that the application:
Passes all (or just marking keys) key down and up events to listbox.
Does not change MSK while in marking mode.
Does not change list’s default additional MSK observer behaviour (see above).
A new observer interface is added for list marking:
/** * Item selection (marking) observer is used to let application control item marking * (in markable lists). Observers can be added and removed by using * @c CEikListBox methods @c AddSelectionObserverL() and * @c RemoveSelectionObserver(). * * @since 3.2 */ class MListBoxSelectionObserver { public: /** * Notification of entering and leaving marking mode. Marking mode * is enabled by long pressing shift, ctrl or hash keys. * * @param aListBox The source list box of this message. * @param aSelectionModeEnabled ETrue, when entering selection (marking) mode. */ virtual void SelectionModeChanged(CEikListBox* aListBox, TBool aSelectionModeEnabled) = 0; /** * Marking can be controlled by this method. By default this * should return ETrue. Just return EFalse for list items that * can't be marked. * * @param aListBox The source list box of this message. * @param aItemIndex The item, which is about to be selected / unselected. * @param aSelection ETrue, when item is about to be selected */ virtual TBool OkToSelectItem(CEikListBox* aListBox, TInt aItemIndex, TBool aSelection) = 0; };