×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    43

    Two Questions On Event Handlers

    1. What is the enumeration for Select and exit keys, the soft keys?

    I am handling events in my game like this,
    TKeyResponse CHelloWorldContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType){
    if(aType == EEventKeyDown){
    switch(iGameState){
    case 1:
    switch(aKeyEvent.iScanCode) {
    case EStdKeyUpArrow:

    ...

    iScanCode is 164 &165 for select & exit (left soft key and right soft key) respectively. Also, what would the enumerations be for keys 0-9. What is the general way to find out? EStdKeyNkpX (0-9) isn't working (it's given in the sdk doc).

    2. How do I exit an application from inside a container? exit() doesn't work.

    Regards
    Last edited by Sukrit; 2004-08-09 at 11:55.

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167
    for the softkeys you'll only get the button Id in the offerkey, so it is always same for all commands that are set to those buttons.

    you should basically handle the commands in command handlers, not in key handlers. For system command button enumerations see avkon.hrh.

    for exit proble, have you tried sending the exit command to your appui's handle command, so only it would handle the exit in all cases.

    yucca

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    43

    Re:

    As I am makin a game, I haven't associated any commands with those keys. I just want the enumeration for the keys so that I can handle them.

    Since the role of these key can, and would be, different in different screens I can't handle them elsewhere.

    Back key, or right soft key would in most screens would be used as a not an exit key but as a back key. In the main screen it would exit the application.


    About how do I send an exit command to the appui's handle?

    THanks for your time & patience.

    REgards

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167
    Ok, you could try EKeyCBA1 & EKeyCBA2, defined in uikon.hrh for the buttons.

    And for sending exit command to AppUi, you could try this:

    CEikonEnv::Static()->EikAppUi()->HandleCommandL(EEikCmdExit);

    yucca

  5. #5
    Registered User
    Join Date
    Jul 2004
    Posts
    43
    Thanks for that.

    Also, what would the enumerations be for keys 0-9. EStdKeyNkpX (0-9) isn't working (it's given in the sdk doc). Nothing in the file uikon.hrh file about.

    0-9 nine keys usually produce 0x30-0x59 (from my memory) as scancode, but nothing is there for those numbers even in e32keys.h

    Regards

  6. #6
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167
    have you tried something like this:

    switch (aKeyEvent.iCode)
    {
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':

    ...

    yucca

  7. #7
    Registered User
    Join Date
    Jul 2004
    Posts
    43
    That doesn't work. The iCode is always zero. The zero key has scan code 0x49 and so forth. I put a watch on the variables and saw while debugging.

    Here is the pertinent part of the code again.

    TKeyResponse CHelloWorldContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType){
    if(aType == EEventKeyDown){
    switch(iGameState){
    case 1:
    switch(aKeyEvent.iScanCode) {


    Also, following works.

    CEikonEnv::Static()->EikAppUi()->HandleCommandL(EEikCmdExit);


    Regards

  8. #8
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167
    hmmm, are you sure you only want to catch the EEventKeyDown events. Most oftenly the actions should be handled when you have EEventKey instead. Anyway depends on the logic.

    yucca

  9. #9
    Registered User
    Join Date
    Jul 2004
    Posts
    43
    if(aType == EEventKey){
    switch(aKeyEvent.iCode){
    case '1':
    break;

    Basically I jsut want to handle any event only once, so I thought I'd handle it on key press down. But just to check for 0-9 keys, I did the above. Anyways the control doesn't come in. iCode is 49 on pressing 0 key. ScanCode is also 49.

    Regards

  10. #10
    Super Contributor
    Join Date
    Feb 2004
    Location
    Dallas
    Posts
    605
    Hi Yucca,
    Is there a way to Simulate Left and Right SoftKey Presses.

    I want to send the Left and Right Soft Key press to Phone App.

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

  12. #12
    Super Contributor
    Join Date
    Feb 2004
    Location
    Dallas
    Posts
    605
    Thnx Yucca,

    But one thing , i have to bring the app to the foreground to send the event.If the app is in background, the event is not processed by it.

    Is there a way to send an event to the task even if it is in background .

    I have tried so far
    Task.SendKey()
    Ws.SendEventtoWndowGroup()
    SimulateKeyEvent() etc ....But all demand the app to be in foreground.

Posting Permissions

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