Namespaces
Variants
Actions

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

Jump to: navigation, search
Archived.png
Archived: 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

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 04:31.
104 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved