×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    28

    The Left and Right Soft Keys

    Hi, How can I make the left and right soft key do a specific task instead of Displaying the options menu(Left soft key) or exiting the app (right soft key). I tried using TKeyResponse but it won't work...


    I tried putting this in my container class...


    Code:
    TKeyResponse CCipherContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
    {    
        if(aType != EEventKey)
        {
    		return EKeyWasNotConsumed;
        }
    	
    	if(aKeyEvent.iCode == EKeyDevice3) //Ok Key
    	{ 
    		
    		if (iCurrentScreen==EMainScreen)
    		{
    			switch(iMenuCode)
    			{
    				case 0:
    					break;
    				case 1:
    					break;
    				case 2:
    					break;
    				case 3:
    					iCurrentScreen=ESettingsScreen;
    					iMenuCode=0;
    					LoadSettingsMenuL();
    					break;
    				case 4:
    					iMenuCode=0;
    					iCurrentScreen=EHelpScreen;
    					LoadHelpMenuL();
    					break;
    				default:
    					break;
    			}
    		}
    		return EKeyWasConsumed;
    		//CAknInformationNote* informationNote = new (ELeave) CAknInformationNote(ETrue); 
    		//informationNote->ExecuteLD(_L("Ok")); 
    	} 
    
    
    	else if(aKeyEvent.iCode == EKeyDevice1) 
    	{ 
    
    		LoadMainMenuL();
    		return EKeyWasConsumed;
    	} 
    
    
        // move Up
        if (aKeyEvent.iScanCode == EStdKeyUpArrow)
    	{
    		iMenuCode--;
    		MenuLoaderL();
            return EKeyWasConsumed;
    	}
    
        // move right
        else if (aKeyEvent.iScanCode == EStdKeyDownArrow)
    	{
    		iMenuCode++;
    		MenuLoaderL();
            return EKeyWasConsumed;
    	}
    
        return EKeyWasNotConsumed;
    }
    Thanks...

  2. #2
    Regular Contributor
    Join Date
    Oct 2004
    Location
    india
    Posts
    306

    Re: The Left and Right Soft Keys

    response for the softkeys are taken care by appui's handle commandl

    so,if u want to make ur own funct for softkeys ..chk ceikbuttongroupcontainer

    setcommandl() func

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    28

    Re: The Left and Right Soft Keys

    Hi, Thanks for the quick reply...

    However, I can't understand how to use the ceikbuttongroupcontainer. I tried looking at the docs but it didn't gave me sufficient information... Could you please give me a sample code? Thanks a lot!

  4. #4
    Regular Contributor
    Join Date
    Oct 2004
    Location
    india
    Posts
    306

    Re: The Left and Right Soft Keys

    in container/view

    CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
    if(cba)
    {
    cba->SetCommandSetL(R_ONE_TWO);
    cba->DrawNow();
    }

    in rss file

    RESOURCE CBA r_one_two
    {
    buttons =
    {
    CBA_BUTTON
    {
    id = Eone;
    txt = "Select";
    },
    CBA_BUTTON
    {
    id = Etwo;
    txt = "Exit";
    }
    };
    }


    in appui under handlecommandL

    case Eone:
    myfunc();
    break;

    case Etwo:
    myfunc2(0;
    break;

  5. #5
    Registered User
    Join Date
    Aug 2005
    Posts
    28

    Re: The Left and Right Soft Keys

    Sure is breaking my head right now... But thanks Girdharn!

  6. #6
    Registered User
    Join Date
    Aug 2005
    Posts
    4

    Re: The Left and Right Soft Keys

    Hey guys,
    Need your help !!!
    I am working on S60 2.8 and i want to change right soft key CBA into a bitmap. the format is defined in avkon.rh but when i am trying to use in my code with the same format then i am able to display only text and not the image. Please help me out as soon as possible.

    thanks a lot.

  7. #7
    Regular Contributor
    Join Date
    Oct 2004
    Location
    india
    Posts
    306

    Re: The Left and Right Soft Keys


  8. #8
    Registered User
    Join Date
    Apr 2003
    Posts
    11

    Re: The Left and Right Soft Keys

    Hi giridharn,

    I saw your comments above. But I have one question more.
    After your ProcessCommandL() has been triggerred and finishing doing what you like there, how could you set the Right/Left soft keys back to what it was before you called SetCommandSetL()

  9. #9
    Regular Contributor
    Join Date
    Oct 2004
    Location
    india
    Posts
    306

    Re: The Left and Right Soft Keys

    hi,
    daoshan..

    Again set it back it its original softkeys by calling


    CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
    if(cba)
    {
    cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_BACK);
    cba->DrawNow();
    }

    use resource id of ur choice..here i used options_back...


    bye
    N.

  10. #10
    Registered User
    Join Date
    Oct 2008
    Posts
    6

    Smile Re: The Left and Right Soft Keys

    Hi Iam working on multiple view , where a user is capable of switching views by selecting the main menu. With different view or window i need different soft key options . Kindly guide me through.
    new to Symbian

  11. #11
    Registered User
    Join Date
    Jun 2006
    Location
    India
    Posts
    1,043

    Re: The Left and Right Soft Keys

    Hi,
    If your requirement is to have different SoftKeys on different views you can define those soft keys (as per your views) in your resource file.Somehting like
    // ---------------------------------------------------------------------------
    // r_mainview
    // Main view.
    // ---------------------------------------------------------------------------
    //
    RESOURCE AVKON_VIEW r_mainview
    {
    menubar = r_mainview_menubar;
    cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;
    }
    similarly for each view you will have separate resource view where you can define your own soft key options.
    Maximus
    S60 Developer
    Impossible is nothing

  12. #12
    Registered User
    Join Date
    Oct 2008
    Posts
    6

    Re: The Left and Right Soft Keys

    Thanx Yogpan for the assistance
    i successfully made all my views . But in one of the views i had put a back option nad the code under it is as follows

    case EAknSoftkeyBack:
    {
    RemoveFromStack(iAppView1);
    iAppView1->MakeVisible(EFalse);
    AddToStackL(iAppView);
    iAppView->MakeVisible(ETrue);
    }
    break;

    AppView, Appview1 being two different views.

    But as i clicked the back option the application terminated instead of coming back to the main menu. and it displayed the message:

    Program Closed:
    Test
    Test1

    Test is my projects name.....what could be this Test1 thing.....??? i searched for all the possible error definition but i coudnt fine this one........Plz help

  13. #13
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: The Left and Right Soft Keys

    The given code fragment should work, though in a view-switching application it would be better using the view-switching architecture instead of swapping containers.
    Otherwise that Test-Test 1 can be a panic initiated from your code, search for User::Panic calls.

  14. #14
    Registered User
    Join Date
    Jun 2006
    Location
    India
    Posts
    1,043

    Re: The Left and Right Soft Keys

    Hi,
    Wizard_hu is correct the Test1 is the panic command which will be there in your test.pan file. Check it there and use view switching for navigating through different views. Here is a good document in wiki on mutli view
    http://wiki.forum.nokia.com/index.ph...with_UI_Design
    Maximus
    S60 Developer
    Impossible is nothing

  15. #15
    Registered User
    Join Date
    Dec 2005
    Posts
    1,236

    Re: The Left and Right Soft Keys

    Quote Originally Posted by chazimbian View Post
    Thanx Yogpan for the assistance
    i successfully made all my views . But in one of the views i had put a back option nad the code under it is as follows

    case EAknSoftkeyBack:
    {
    RemoveFromStack(iAppView1);
    iAppView1->MakeVisible(EFalse);
    AddToStackL(iAppView);
    iAppView->MakeVisible(ETrue);
    }
    break;

    AppView, Appview1 being two different views.

    But as i clicked the back option the application terminated instead of coming back to the main menu. and it displayed the message:

    Program Closed:
    Test
    Test1

    Test is my projects name.....what could be this Test1 thing.....??? i searched for all the possible error definition but i coudnt fine this one........Plz help
    Hi,

    Is it much easier to call ActivateLocalViewL and let the view framework take care of the rest. I would follow the link posted by yogpan.
    Regards,
    Sriky

Posting Permissions

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