×
Namespaces

Variants
Actions

Archived:Controlling the keyboard repeat rate

From Nokia Developer 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)
Compatibility
Platform(s): S60 3rd Edition
S60 3rd Edition, FP1
S60 3rd Edition, FP2
Symbian
S60 3rd Edition FP2
S60 3rd Edition FP1
S60 3rd Edition (initial release)
Article
Keywords: GetKeyboardRepeatRate, SetKeyboardRepeatRate
Created: User:Kbwiki (29 Jun 2010)
Last edited: hamishwillee (11 Oct 2012)

Overview

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

Description

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.


Solution

  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>
#endif
 
int main( int argc, char *argv[] )
{
QApplication a( argc, argv );
...
#ifdef Q_OS_SYMBIAN
 
QApplication::setNavigationMode( Qt::NavigationModeCursorAuto );
 
CCoeEnv::Static()->WsSession().SetKeyboardRepeatRate( 200000, 50000 );
 
#endif
...
}

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

 symbian {
TARGET.CAPABILITY += WriteDeviceData
LIBS += -lcone -lws32
}
This page was last modified on 11 October 2012, at 04:19.
54 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.

×