×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Regular Contributor
    Join Date
    Apr 2006
    Location
    Malaysia
    Posts
    246

    cba for selection list dialog

    I have selection list dialog which has list and search box. My question is how to change menu bar for this dialog. At the moment i'm using cba OK_CANCEL and it's work fine. But i have problem when I change to cba OPTIONS_BACK.

    Any idea how to do it? Do i need to use processcommandL() or handlecommandL()?

    Thanks

  2. #2
    Super Contributor
    Join Date
    May 2005
    Location
    Hyderabad,India
    Posts
    704

    Re: cba for selection list dialog

    Hi,


    Dialogs take one click event only. If u use OPTIONS_BACK for options it's using two click events. If u want to use OPTIONS_BACK u need to use DynInitMenuPaneL() in ur dialog and construct ur dialog with menu resource id.

    regards,
    eswar

  3. #3
    Super Contributor
    Join Date
    Jul 2005
    Posts
    1,686

    Re: cba for selection list dialog

    add the following code in rss file;

    RESOURCE CBA r_yourapp_softkeys_options_open
    {
    buttons =
    {
    CBA_BUTTON { id=EAknSoftkeyOptions; txt = "Options"; },
    CBA_BUTTON { id=EYourAppCmdOpenApp; txt = "Open"; }
    };
    }

    RESOURCE CBA r_yourapp_softkeys_options_stop
    {
    buttons =
    {
    CBA_BUTTON { id=EAknSoftkeyOptions; txt = "Options"; },
    CBA_BUTTON { id=EYourAppCmdStopApp; txt = "Stop"; }
    };
    }


    In the HRH file:


    Code:
    enum TYourAppCommandIds
    {
    // ...
    id=EYourAppCmdOpenApp,
    id=EYourAppCmdStopApp,
    // ...
    };


    In your application's AppUi class:


    Code:
    void CYourAppUi::SetCommandSetL(TInt aResourceId)
    {
    CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
    cba->SetCommandSetL( aResourceId );
    }


    Now you can call:

    SetCommandSetL( R_YOURAPP_SOFTKEYS_OPTIONS_OPEN );
    OR
    SetCommandSetL( R_YOURAPP_SOFTKEYS_OPTIONS_STOP );

    where ever you want.

  4. #4
    Regular Contributor
    Join Date
    Apr 2006
    Location
    Malaysia
    Posts
    246

    Re: cba for selection list dialog

    Hi cool,

    thanks for the code. It's work fine. but how to set the command for it? i want the options button works like default options button. but nothing happen when i click on options.

    for the dialog... there are 2 menu items for the options button: 1)selection and 2)delete
    how to do that?
    Last edited by ninidotnet; 2006-05-15 at 03:44.

  5. #5
    Super Contributor
    Join Date
    Jul 2005
    Posts
    1,686

    Re: cba for selection list dialog

    It has two commands associated with it: EAnkSoftkeyOptions, which is standard for Series 60, and defined in avkon.hrh;EYourAppCmdStopApp, the stop command. The handling of these commands is done exactly in the same way as for menu commands: in CYourAppUi's HandleCommandL() function.

  6. #6
    Super Contributor
    Join Date
    Jul 2005
    Posts
    1,686

    Re: cba for selection list dialog

    RESOURCE MENU_BAR r_View1_menubar
    {
    titles =
    {
    MENU_TITLE {menu_pane = r_View1_menu;}
    };
    }

    RESOURCE MENU_PANE r_View1_menu
    {
    items =
    {
    MENU_ITEM {command = EViewSelectionCmd; txt = "selection";},
    MENU_ITEM {command = EViewDeleteCmd; txt = "delete";}
    };
    }

    CEikonEnv* eikonEnv = CEikonEnv::Static();
    MEikAppUiFactory* appUiFactory = eikonEnv->AppUiFactory();
    CEikMenuBar* menuBar = appUiFactory->MenuBar();

    menuBar->StopDisplayingMenuBar();
    menuBar->SetMenuTitleResourceId(R_VIEW1_MENUBAR);

  7. #7
    Regular Contributor
    Join Date
    Apr 2006
    Location
    Malaysia
    Posts
    246

    Re: cba for selection list dialog

    hi cool,
    this is my code. how to set options so that it will display selection and delete menu whe user click on it. i did what u said but the program crashed.

    in resource file
    Code:
    RESOURCE MENU_PANE r_syphersms_menu15
        {
        items =
            {
              MENU_ITEM
                              {
                              command = ESypherSMSCmdSelection;
                              txt = ADD_SELECTION_TEXT;
                              },
              MENU_ITEM
                              {
                              command = ESypherSMSCmdDelete;
                              txt = DELETE_TEXT;
                              }
            };
        }
    
    RESOURCE CBA r_syphersms_softkeys_options_close
    {
    buttons = 
    {
    CBA_BUTTON { id=EAknSoftkeyOptions; txt = "Options"; },
    CBA_BUTTON { id=ESypherSMSCmdClose; txt = "Close"; }
    };
    }
    in engine.cpp
    Code:
    void CSypherSMSPhoneEngine::AddressView()
        {
        TInt openedItem(0);
        // Construct and prepare the dialog
        CAknSelectionListDialog* phonebook = CAknSelectionListDialog::NewL(openedItem, NULL, 0);
        phonebook->PrepareLC (R_SYPHERSMS_PHONEBOOK_DIALOG);
        SetCommandSetL( R_SYPHERSMS_SOFTKEYS_OPTIONS_CLOSE );
          
        // Execute the dialog
        if (phonebook->RunLD ())
            {
            OpenPhoneNumber(openedItem);
            }
        }
    in appui
    Code:
    void CSypherSMSView2::HandleCommandL(TInt aCommand)
        {
          switch(aCommand)
          {
            // ....
            // ....
          case ESypherSMSCmdClose:
          {
            AppUi()->ActivateLocalViewL(TUid::Uid(ESypherSMSView2Id));
            break;
          }
    
            default:
            {
              AppUi()->HandleCommandL(aCommand);
              break;
            }
            // ....
            // ....
    
          }
        }
    i manage to replace the buttons. But when I click on options no menu items appear.that's all...thanks

  8. #8
    Super Contributor
    Join Date
    Jul 2005
    Posts
    1,686

    Re: cba for selection list dialog

    After you call the SetCommandSetL() function , please insert the folowing code:
    CEikonEnv::Static()->AppUiFactory()->cba()->DrawDeferred();
    redraw the cba bar.
    Last edited by cool_li; 2006-05-15 at 08:52.

  9. #9
    Regular Contributor
    Join Date
    Apr 2006
    Location
    Malaysia
    Posts
    246

    Re: cba for selection list dialog

    what header file should be included. i get error during compilation.

  10. #10
    Super Contributor
    Join Date
    Jul 2005
    Posts
    1,686

    Re: cba for selection list dialog

    In your application's AppUi class:


    look at #3
    Code:
    void CYourAppUi::SetCommandSetL(TInt aResourceId)
    {
    CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
    cba->SetCommandSetL( aResourceId );
    cba->DrawDeferred();//add this line

    }

  11. #11
    Regular Contributor
    Join Date
    Apr 2006
    Location
    Malaysia
    Posts
    246

    Re: cba for selection list dialog

    Ok, this code works fine. but still, when i click on options .. it didn't show the menu. The rest is ok.


    Code:
    void CSypherSMSPhoneEngine::SetCommandSetL(TInt aResourceId)
    {
    CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
    cba->SetCommandSetL( aResourceId );
    cba->DrawDeferred();
    }
    Code:
    void CSypherSMSPhoneEngine::AddressView()
        {
        TInt openedItem(0);
        // Construct and prepare the dialog
        CAknSelectionListDialog* phonebook = CAknSelectionListDialog::NewL(openedItem, NULL, 0);
        phonebook->PrepareLC (R_SYPHERSMS_PHONEBOOK_DIALOG);
        SetCommandSetL( R_SYPHERSMS_SOFTKEYS_OPTIONS_CLOSE );
    
        // Execute the dialog
        if (phonebook->RunLD ())
            {
            OpenPhoneNumber(openedItem);
            }
        }

  12. #12
    Super Contributor
    Join Date
    Jul 2005
    Posts
    1,686

    Re: cba for selection list dialog

    in my application is ok.
    you can email your code in my email box
    yongfeili@gmail.com
    I need a complete code to analyse.

  13. #13
    Regular Contributor
    Join Date
    Apr 2006
    Location
    Malaysia
    Posts
    246

    Re: cba for selection list dialog

    i sent to you my code. hope it can help you.

    Thanks

  14. #14
    Super Contributor
    Join Date
    Jul 2005
    Posts
    1,686

    Re: cba for selection list dialog

    set the menubar's content like the following code
    Code:
      CEikonEnv* eikonEnv = CEikonEnv::Static();
      MEikAppUiFactory* appUiFactory = eikonEnv->AppUiFactory();
      CEikMenuBar* menuBar = appUiFactory->MenuBar();
      CEikButtonGroupContainer* cba = appUiFactory->Cba();
      
      menuBar->StopDisplayingMenuBar();
      menuBar->SetMenuTitleResourceId(R_VIEWSERVER_MENUBAR_PARAM);
      cba->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_EXIT);
      cba->DrawDeferred();
    and then delete some line of code about a dialog, try it again
    void CSypherSMSPhoneEngine::AddressView()
    {
    //TInt openedItem(0);
    // Construct and prepare the dialog
    //CAknSelectionListDialog* phonebook = CAknSelectionListDialog::NewL(openedItem, NULL, 0);
    //phonebook->PrepareLC (R_SYPHERSMS_PHONEBOOK_DIALOG);
    SetCommandSetL( R_SYPHERSMS_SOFTKEYS_OPTIONS_CLOSE );
    //CEikonEnv::Static()->AppUiFactory()->cba()->DrawDeferred();

    // Execute the dialog
    //if (phonebook->RunLD ())
    //{
    //OpenPhoneNumber(openedItem);
    //}
    }

  15. #15
    Regular Contributor
    Join Date
    Apr 2006
    Location
    Malaysia
    Posts
    246

    Re: cba for selection list dialog

    Hi cool,

    the defined cba is actually to replace the dialog's cba. i did like what u said, but it crash when i run the program.

    it is possible to have menu options for CAknSelectionListDialog instead of OK_CANCEL cba, isn't it?


    I refer to aknselectionlist.h file and found this:

    class CAknSelectionListDialog : public CAknDialog, public MEikListBoxObserver
    {

    public: // operands for selection lists
    /** CAknSelectionListDialog::NewL()
    *
    * aOpenedItem Variable to be modified when user selects a list item.
    * aArray Content of list items; A tab-separated string with texts and indexes to icon array
    * aMenuBarResourceId Menu items to be shown in options menu
    * aCommand Callback for state changes. EAknCmdOpen command is send by listbox. Options menu commands come here too.
    */
    IMPORT_C static CAknSelectionListDialog *NewL( TInt &aOpenedItem, MDesCArray *aArray, TInt aMenuBarResourceId, MEikCommandObserver *aCommand = 0 );
    IMPORT_C static CAknSelectionListDialog *NewLC( TInt &aOpenedItem, MDesCArray *aArray, TInt aMenuBarResourceId, MEikCommandObserver *aCommand = 0 );

    //....
    //....
    }


    Can you tell me what does it means?
    Last edited by ninidotnet; 2006-05-17 at 05:44.

Similar Threads

  1. 6680 and bluetooth service profiles
    By ceruault in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-10-08, 22:24
  2. How to - Dynamically update icons in List or Dialog
    By relliott98 in forum Symbian User Interface
    Replies: 1
    Last Post: 2005-06-13, 14:08
  3. setting list in dialog
    By wapawapa in forum Symbian User Interface
    Replies: 0
    Last Post: 2004-08-07, 05:34
  4. list , dialog , series 60
    By white_dragon in forum Symbian
    Replies: 0
    Last Post: 2004-08-03, 12:50
  5. OK CBA button hidden from dialog
    By enhariharan in forum Symbian User Interface
    Replies: 1
    Last Post: 2003-08-24, 11:00

Posting Permissions

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