Namespaces

Variants
Actions

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 over the next few weeks. Thanks for all your past and future contributions.

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

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

Overview

How to programmatically toggle the input mode of an editor

Description

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;   
        keypress.SetType(EEventKeyDown);
        keypress.SetTimeNow();
        wSess.SendEventToWindowGroup( wgId, keypress );
        User::After(2000);   
        keypress.SetType(EEventKey);
        keypress.SetTimeNow();
        wSess.SendEventToWindowGroup( wgId, keypress );
        User::After(2000);   
        keypress.SetType(EEventKeyUp);
        keypress.SetTimeNow();   
        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.
27 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.

×