Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Archived:Controlling the keyboard repeat rate

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Tested with
Devices(s): All (S60 non-touch)
Platform(s): S60 3rd Edition
S60 3rd Edition, FP1
S60 3rd Edition, FP2
S60 3rd Edition FP2
S60 3rd Edition FP1
S60 3rd Edition (initial release)
Keywords: GetKeyboardRepeatRate, SetKeyboardRepeatRate
Created: User:Kbwiki (29 Jun 2010)
Last edited: hamishwillee (11 Oct 2012)


This article shows how to change the keyboard repeat rate on Symbian devices using Symbian C++ code in Qt applications.


Keyboard repeat rate in Symbian devices can be controlled using functions from the RWsSession class:

  void GetKeyboardRepeatRate( TTimeIntervalMicroSeconds32 &aInitialTime, 
TTimeIntervalMicroSeconds32 &aTime );
TInt SetKeyboardRepeatRate( const TTimeIntervalMicroSeconds32 &aInitialTime,
const TTimeIntervalMicroSeconds32 &aTime );

Because the repeat rate is a global setting, the WriteDeviceData capability is required for SetKeyboardRepeatRate(). Also, applications modifying the repeat rate should reset back to the default values whenever switched to background or terminated.


  CCoeEnv::Static()->WsSession().SetKeyboardRepeatRate( 200000, 50000 );

Virtual mouse cursor in Qt applications

On non-touch Symbian devices, the following code will enable a virtual mouse cursor, controlled by the navigation keys:

  QApplication::setNavigationMode( Qt::NavigationModeCursorAuto );

The speed of the cursor movement can be controlled by changing the keyboard repeat rate as above.

For example, to set the initial delay to 200 milliseconds, and subsequent repeats to 50 milliseconds:

 #ifdef Q_OS_SYMBIAN
#include <coemain.h>
#include <w32std.h>
int main( int argc, char *argv[] )
QApplication a( argc, argv );
QApplication::setNavigationMode( Qt::NavigationModeCursorAuto );
CCoeEnv::Static()->WsSession().SetKeyboardRepeatRate( 200000, 50000 );

In the .pro file, add the WriteDeviceData capability and the required libraries:

 symbian {
LIBS += -lcone -lws32
This page was last modified on 11 October 2012, at 01:19.
75 page views in the last 30 days.