×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Nov 2006
    Posts
    260

    why my app dosen't receive key events......

    hi 2 all,

    My app is running in background..and on some key presses i want to bring my app on foreground.for that i have used following code.......

    in my appui constructL
    CAknAppUi::SetKeyBlockMode(ENoKeyBlock);
    Key2 = iEikonEnv->RootWin().CaptureKeyUpAndDowns(EStdKeyHash,0,0);

    and in my HandleKeyEventL()

    TBool keypress1 = (aType == EEventKeyDown && aKeyEvent.iScanCode == EStdKeyHash);
    TBool keypress2 = (aType == EEventKeyDown && aKeyEvent.iScanCode == EStdKeyNkpAsterisk);
    if(keypress1)
    {
    return EKeyWasNotConsumed;
    }
    if(keypress1 && keypress2)
    {
    TApaTask task(iEikonEnv->WsSession( ));
    task.SetWgId(CEikonEnv::Static()->RootWin().Identifier());
    task.BringToForeground();
    return EKeyWasConsumed;
    }


    this dosent gives any error to me......but when i installed my app on device and while my app is in background it dosent received any keyevents during that.

    does it require any additional capability?.....or am i missing something in my code?.........

    i have gone through much posts on forum but havent found any bug in my code.

    regards
    Bharat

  2. #2
    Regular Contributor
    Join Date
    Feb 2005
    Posts
    328

    Re: why my app dosen't receive key events......

    I think you will need the SwEvent capability to do this...

  3. #3
    Regular Contributor
    Join Date
    Nov 2006
    Posts
    260

    Re: why my app dosen't receive key events......

    thanks for reply .....

    sorry i am new bie to symbian.......
    i dont know how to add capability to my app?......will anyone elaborate something on how should i add the required capabilty to cature the the key events when my app is running in background?...

    any pointers in this regards will be highly appreciated.

    regards
    bye.

  4. #4
    Regular Contributor
    Join Date
    Feb 2005
    Posts
    328

    Re: why my app dosen't receive key events......

    Have a look at the example code in the SDK. In the case of "helloworldbasic", take a look at it's MMP file: see the line at the bottom: CAPABILITY? That's where you need to add additional capabilities...

    /*
    * ==============================================================================
    * Name : helloworldbasic.mmp
    * Part of : Helloworldbasic
    * Interface :
    * Description :
    * Version :
    *
    * Copyright (c) 2005-2006 Nokia Corporation.
    * This material, including documentation and any related
    * computer programs, is protected by copyright controlled by
    * Nokia Corporation.
    * ==============================================================================
    */

    TARGET HelloWorldBasic.exe
    TARGETTYPE exe
    UID 0x100039CE 0xA000017F

    SECUREID 0xA000017F
    EPOCSTACKSIZE 0x5000

    SOURCEPATH ..\src
    SOURCE HelloWorldBasic.cpp
    SOURCE HelloWorldBasicApplication.cpp
    SOURCE HelloWorldBasicAppView.cpp
    SOURCE HelloWorldBasicAppUi.cpp
    SOURCE HelloWorldBasicDocument.cpp

    SOURCEPATH ..\data

    START RESOURCE HelloWorldBasic.rss
    HEADER
    TARGETPATH resource\apps
    END //RESOURCE

    START RESOURCE HelloWorldBasic_reg.rss
    #ifdef WINSCW
    TARGETPATH \private\10003a3f\apps
    #else
    TARGETPATH \private\10003a3f\import\apps
    #endif
    END //RESOURCE



    USERINCLUDE ..\inc

    SYSTEMINCLUDE \epoc32\include

    LIBRARY euser.lib
    LIBRARY apparc.lib
    LIBRARY cone.lib
    LIBRARY eikcore.lib
    LIBRARY avkon.lib
    LIBRARY commonengine.lib
    LIBRARY efsrv.lib
    LIBRARY estor.lib

    LANG SC

    VENDORID 0
    CAPABILITY NONE

    // End of File

  5. #5
    Regular Contributor
    Join Date
    Apr 2006
    Location
    Mumbai. India.
    Posts
    204

    Re: why my app dosen't receive key events......

    Hi,

    You may be forgotto add your container to Stack.
    Go to you view implementation, check the definition of DoActivateL()

    {
    ASSERT(!(iContainer));
    iContainer = CMemoryTestContainer1::NewL(ClientRect());
    AppUi()->AddToStackL(*this,iContainer); // i think you miss this line of code, it will add your container to stack and will help to listen the events.
    }

    Check for this. It will help you.

    Regards,
    Pankaj
    Mumbai.

Similar Threads

  1. second form not getting key events
    By krsunil in forum Symbian User Interface
    Replies: 3
    Last Post: 2008-12-10, 10:29
  2. Replies: 3
    Last Post: 2006-08-22, 10:48
  3. how to caputure key events in 7650 emulator
    By Jack99 in forum Symbian
    Replies: 3
    Last Post: 2003-08-18, 08:17
  4. Key Events
    By alepe in forum Symbian
    Replies: 4
    Last Post: 2003-06-02, 07:17
  5. Key Event Issues
    By mykes in forum Symbian
    Replies: 0
    Last Post: 2003-05-01, 10:55

Posting Permissions

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