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.