×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    19

    Thumbs up [SOLVED] [S90] CBA key working and not working (ARM vs. WINSCW)

    Hi!

    I'm currently developing onto Nokia 7710 which is an absolutely splendid device; never really wanted to get those S60 devices. I have a problem which is of rather weird type:
    I have a "Close" button on the third virtual CBA button, and it works flawlessly on the WINSCW emulator (when I press it, the program closes), but on the phone the program doesn't close! But I have a menu entry called "Close" and the program shuts down very nicely from there. Here are the required code snippets:

    In the RSS file:
    Code:
    RESOURCE CBA r_example_cba
        {
        breadth=80;
        buttons=
            {
            CBA_BUTTON
                {
                id=ECbaButton0;
                txt="";
                bmpfile="";
                bmpid=0xffff;
                },
            CBA_BUTTON
                {
                id=ECbaButton1;
                txt="";
                bmpfile="";
                bmpid=0xffff;
                },
            CBA_BUTTON
                {
                id=ECbaButton2;
                txt="Close";
                bmpfile="";
                bmpid=0xffff;
                }
            };
        }
    In the HRH file:
    Code:
    enum TExampleCbaCommands
    	{
    	ECbaButton0,
    	ECbaButton1,
    	ECbaButton2
    	};
    In the Program_AppUI.cpp file
    Code:
    switch (aCommand)
    		{
                   // Exit the application. The call is
    	       // implemented by the UI framework.
    	case ECbaButton2:
    	case EEikCmdExit: 
    		Exit();
    		break;
    		}

    On S80 the code works perfectly, the only difference being that there are four CBA button entries in which the fourth has the "Close" text applied. So... I really don't see anything wrong in these lines, but if you do, please inform me kindly.

    PS. I know what I'm doing, S90 is dead and extinct, but I'm not doing anything major, just an app for my own purposes :)
    Thank you in advance,
    - Sami
    Last edited by Sambon5; 2009-08-18 at 08:13.

  2. #2
    Registered User
    Join Date
    Mar 2005
    Posts
    19

    Re: [S90] CBA key working and not working (ARM vs. WINSCW)

    Well, well, well, what do we have here...
    I changed the order of the two aCommands so it reads this in the Program_AppUI.cpp file now:
    Code:
    switch (aCommand)
    		{
                   // Exit the application. The call is
    	       // implemented by the UI framework.
    	case EEikCmdExit: 
    	case ECbaButton2:
    		Exit();
    		break;
    		}
    In the same file there was a line (added by me when making the S80 version) inside the void CProgramAppUi::ConstructL() function called AddToStackL(iAppView);, so I removed it to see what it gives, and voilá! The program closes nicely on the target device now. So it's solved now.

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,737

    Re: [S90] CBA key working and not working (ARM vs. WINSCW)

    Hmm, do you have an OfferKeyEventL in your view?

  4. #4
    Registered User
    Join Date
    Mar 2005
    Posts
    19

    Re: [S90] CBA key working and not working (ARM vs. WINSCW)

    Yes, I do. The implementation reads as follows (remains of the S80 version):
    Code:
    TKeyResponse CProgramAppView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType) 
       { 
        TInt code=aKeyEvent.iCode;
        switch (code) 
                { 
                case EKeyEnter:
    		User::Exit(0);
    		break;
                default:
    		break;
                return(EKeyWasConsumed); 
    	    }
       }

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,737

    Re: [S90] CBA key working and not working (ARM vs. WINSCW)

    Adding a "return EKeyWasNotConsumed;" at the end may solve the initial problem.

  6. #6
    Registered User
    Join Date
    Mar 2005
    Posts
    19

    Re: [S90] CBA key working and not working (ARM vs. WINSCW)

    Well now I don't understand anything... I put the code back to its starting point (like in the first post of this thread) and tried the EKeyWasNotConsumed solution... The application closed when pressed.
    Then I put the code back to its initial starting point with the EKeyWasConsumed word (just like in the first place) so it was exactly like in the first post and... weirdly, it now closes like in other situations. That's odd because it shouldn't close because it's in the initial form!

    Well, I think after all there was no problem about the code, just some oddity within the S90 interface?

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,737

    Re: [S90] CBA key working and not working (ARM vs. WINSCW)

    My complete experience with S90 is playing with a 7700 proto for half a day, and I have also seen a 7710 three times in the hands of other people. So I do not know how it works, and never coded for it. Based on your description my guess would be that touch events on the control pane are converted to keyboard events, then fed to the control stack. And if some control reports EKeyWasConsumed, the story ends, the event has been handled. If it reaches the bottom (EKeyWasNotConsumed), it gets processed further, and sooner or later arrives to HandleCommandL.
    In fact it would not be that exotic thing, on "button based" S60 devices CCoeControl-s also get the events for the command buttons - just I have not tried what happens if I deliberately return EKeyWasConsumed.

  8. #8
    Registered User
    Join Date
    Mar 2005
    Posts
    19

    Re: [S90] CBA key working and not working (ARM vs. WINSCW)

    7700, nice. Well I think you're right in your assumption; I don't know about the internals so much but I believe it goes somewhat like that.
    Thank you very much for your help, wizard_hu_.
    Last edited by Sambon5; 2009-08-20 at 15:53.

Posting Permissions

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