Archived:How to toggle the input mode of an editor using Symbian C++

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
Platform(s): S60 2nd Edition and S60 3rd Edition
S60 3rd Edition (initial release)
S60 2nd Edition (initial release)
Created: User:Technical writer 2 (March 8, 2007, Updated September 14, 2007)
Last edited: hamishwillee (15 Jun 2012)


How to programmatically toggle the input mode of an editor


By simulating the hash (#) key event, it is possible to toggle the input mode of the currently focused editor between normal and numeric modes.
#include <ptidefs.h>        // for EPtiKeyHash
    RWsSession wSess;
    User::LeaveIfError( wSess.Connect() );
    TInt wgId = wSess.GetFocusWindowGroup();
    if( wgId != KErrNotFound )
        TWsEvent keypress;   
        keypress.Key()->iCode = EPtiKeyHash;
        keypress.Key()->iScanCode = 0;
        keypress.Key()->iModifiers = 0;
        keypress.Key()->iRepeats = 1;   
        wSess.SendEventToWindowGroup( wgId, keypress );
        wSess.SendEventToWindowGroup( wgId, keypress );
        wSess.SendEventToWindowGroup( wgId, keypress );

Note: On S60 3rd Edition devices, the following code requires SwEvent capability.

Note: This does not work in devices with a full keyboard.

This page was last modified on 15 June 2012, at 01:31.
37 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.