The Symbian platform now includes AknLayoutUtils::PenEnabled() to check for touch support at runtime to allow for reduced run-time memory consumption if the device does not support touch.
Typical cases where AknLayoutUtils::PenEnabled() might be useful include:
In the component’s constructor to skip the creation of touch-only component controls.
In the component’s HandleResourceChange, create touch-only component controls if the layout is switched from a non-touchable to a touchable one. Touch-only component controls should not be deleted.
In the component’s drawing code.
AknLayoutUtils::PenEnabled() is supported from S60 3rd Edition, FP1, onwards.
void CMyAppContainer::ConstructL( const TRect& aRect ) { CreateWindowL(); SetRect( aRect ); // If the device supports touch, construct long tap detector if ( AknLayoutUtils::PenEnabled() ) { iLongTapDetector = CAknLongTapDetector::NewL( this ); } ActivateL(); }
You cannot use AknLayoutUtils::PenEnabled() in .rss resource files.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.