(Difference between revisions)

Handling new touch-related MEikListBoxObserver events

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot fixing redirect link.(Moving links from forum.nokia.com TO developer.nokia.com))
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot change of template (Template:CodeSnippet) - now using Template:ArticleMetaData)
Line 2: Line 2:
|platform=S60 5th Edition
|platform=S60 5th Edition
Line 10: Line 10:
|creationdate=October 14, 2008
|creationdate=October 14, 2008
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
|sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
|signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices. -->)

Revision as of 11:35, 24 June 2011


Article Metadata
Tested with
Devices(s): Nokia 5800 XpressMusic
Platform(s): S60 5th Edition
Platform Security
Capabilities: )
Keywords: MEikListBoxObserver::HandleListBoxEventL()
Created: tepaa (14 Oct 2008)
Last edited: hamishwillee (24 Jun 2011)


S60 5th Edition supports touch events. All AVKON UI controls handle touch UI events and you do not need to implement anything new.

If your UI control has a listbox and it is listening for listbox events using MEikListBoxObserver, you need to handle a few new events related to touch UI:

* EEventItemClicked            // Item single-tap event
* EEventItemDoubleClicked      // Item two-taps event
* EEventPenDownOnItem          // Pen is down and over an item
* EEventItemDraggingActioned   // Pen is dragged from item to another

Note that CAknSingleStyleListBox already handles its touch UI pointer events in its AVKON base class CAknColumnListBox::HandlePointerEventL(). Do not override this implementation.

MMP file

The following libraries are required:

LIBRARY avkon.lib
LIBRARY eikcoctl.lib
LIBRARY eikctl.lib

Header file

#include <aknlists.h> // CAknSingleStyleListBox
#include <eiklbo.h> // MEikListBoxObserver

Source file

CAknSingleStyleListBox is inside the control and it is created in ConstructL().

void CMyContainer::ConstructL(const TRect& aRect)
// Initialize component array
// Create listbox
iSearchListBox = new (ELeave) CAknSingleStyleListBox;
TResourceReader reader;
CEikonEnv::Static()->CreateResourceReaderLC(reader, R_MY_LISTBOX);
CleanupStack::PopAndDestroy(); //reader
// --> Start event listening
// Enable scrollbars
->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,
CleanupStack::Pop( iSearchListBox );

Listbox event listening is implemented below. Note the new EEventItemDoubleClicked event related to touch UI. The EEventEnterKeyPressed event is the old selection key event (from S60 3rd Edition).

void CMyContainer::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType)
if (aEventType == EEventEnterKeyPressed || aEventType == EEventItemDoubleClicked)
// TODO: Listbox got double click, what to do?
// From CEikListBox::CurrentItemIndex() you could get the selected row...


The application handles listbox pointer events.

See also

S60 Platform: Calendar Interim API Example

81 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.