×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    May 2006
    Location
    Milan, Italy
    Posts
    92

    simulate key pressed in main window (3d)

    hi,
    I read the posts about the simulation of key pressed , but I'm not still able to exec the operation in a real 3d edition device (e60).

    with this code :

    Code:
    RWsSession sess=CCoeEnv::Static()->WsSession();
    	TWsEvent event;
    	TInt id=sess.FindWindowGroupIdentifier( 0, _L("*Phone?") );
    
    
    	event.SetType(EEventKey);
    	event.SetTimeNow();
    	event.Key()->iCode = 50;
    	event.Key()->iModifiers = 1;
    	event.Key()->iRepeats = 0;
    	event.Key()->iScanCode = 50;
    	sess.SendEventToWindowGroup( id, event );
    
    	event.SetType(EEventKey);
    	event.SetTimeNow();
    	event.Key()->iCode = 49;
    	event.Key()->iModifiers = 1;
    	event.Key()->iRepeats = 0;
    	event.Key()->iScanCode = 49;
    	sess.SendEventToWindowGroup( id, event );
    
    
    	//13699295834
    	event.SetType(EEventKey);
    	event.SetTimeNow();
    	event.Key()->iCode = 49;
    	event.Key()->iModifiers = 1;
    	event.Key()->iRepeats = 0;
    	event.Key()->iScanCode = 49;
    	sess.SendEventToWindowGroup( id, event );
    
    	event.SetType(EEventKey);
    	event.SetTimeNow();
    	event.Key()->iCode = 57;
    	event.Key()->iModifiers = 1;
    	event.Key()->iRepeats = 0;
    	event.Key()->iScanCode = 57;
    	sess.SendEventToWindowGroup( id, event );
    
    	event.SetType(EEventKey);
    	event.SetTimeNow();
    	event.Key()->iCode = 57;
    	event.Key()->iModifiers = 1;
    	event.Key()->iRepeats = 0;
    	event.Key()->iScanCode = 57;
    	sess.SendEventToWindowGroup( id, event );
    I past on main window a sequence of 5 numbers (my idea is past a number and start a call with this key simulation)

    This code works on emulator but not in real device ( I have used swEvent capability ) .

    any Idea ?

    regards.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: simulate key pressed in main window (3d)

    maybe your phone is not using English as system language, thus there wouldn't be a task that would have word Phone in ut.

    yucca

  3. #3
    Regular Contributor
    Join Date
    May 2006
    Location
    Milan, Italy
    Posts
    92

    Re: simulate key pressed in main window (3d)

    in fact... my telephone is an italian version and the name is writed in italian ...

    thanks !!


    I have some others troubles...
    now I print ond the screen the numbers , when the numbers are visible I return to application
    with this sequence of operations my application execute only 1 time the command... also if I kill it and I restart it, the application don't write the numbers in the screen for the second time... I need to restart the phone ( like windows... sigh ) for execute for the second time the operations ...

    I think that the problem is generated because I'm not able to press the green key for start the call from the application...

    In fact if I press myself the button after the print ( via code ) of the numbers the application is able to repeat the operations many times...

    How I can press the green button for start the call ?

    thanks..

  4. #4
    Regular Contributor
    Join Date
    May 2006
    Location
    Milan, Italy
    Posts
    92

    Question Re: simulate key pressed in main window (3d)

    ok... with this code I can press the green key

    event.SetType(EEventKey);
    event.SetTimeNow();
    event.Key()->iCode = EKeyYes;
    event.Key()->iModifiers = 0;
    event.Key()->iRepeats = 0;
    event.Key()->iScanCode = EStdKeyNull;
    sess.SendEventToWindowGroup( id, event );

    but some problems still remains... in fact if I stop manually with the red key the call the window with the numbers remains and if I press for the second time the red button I must restart the phone for execute for the second time the operation from my application.

    I don't understand why ....

Similar Threads

  1. Replies: 8
    Last Post: 2009-01-24, 06:00
  2. Advice to simulate long key press from application?
    By roger.planas in forum Symbian
    Replies: 11
    Last Post: 2006-12-04, 12:42
  3. Simulate key event in Messaging app
    By Gardhul in forum Symbian User Interface
    Replies: 1
    Last Post: 2006-11-30, 14:45
  4. Replies: 2
    Last Post: 2005-12-01, 10:03
  5. Replies: 0
    Last Post: 2004-01-12, 17:47

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •