×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    2

    [moved] Q: How to change toolbar button text

    I'm a Delhpi and VB.net developer, who is new to programming in Symbian C++.
    I've come to do something simple, but failed to do so succesfully: I want to change the text of a button, when clicked, on a toolbar in a listboxview in Carbide C++.
    In Carbide I've made a toolbar with a button and set the Toolbar event Selected.
    In my listboxview (cpp) I get the follwing function:

    TBool CTest26ListBoxView::HandleBtnShopSelectedL( TInt aCommand )

    To get to the button on the toolbar I've coded:

    CAknToolbar* toolbar = Toolbar();
    if ( toolbar )
    {
    CAknButton* button = static_cast<CAknButton*>(toolbar->ControlOrNull(ETest26ListBoxViewBtnShopCommand2));
    if ( button )
    {
    }
    }

    My question: is this the right way to get to the button on the toolbar and how do I change the text on the button???
    Hopefully somebody knows. I've searched and tried to do this for several hours and almost giving up.
    Tnx in advance for any help.

  2. #2
    Registered User
    Join Date
    Apr 2009
    Posts
    2

    Thumbs up Re: [moved] Q: How to change toolbar button text

    I've found the answer at last !!!

    TBool CTest26ListBoxView::HandleButton1SelectedL( TInt aCommand )
    {
    CAknToolbar* toolbar = Toolbar();
    if ( toolbar )
    {
    CAknButton* button = static_cast<CAknButton*>( toolbar->ControlOrNull(ETest26ListBoxViewButton1Command) );
    if ( button )
    {
    CAknButtonState* lButtonState = button->State();
    lButtonState->SetTextL(_L("New text"));
    }
    }
    toolbar->DrawNow();

    return ETrue;
    }

Similar Threads

  1. [moved] How to change softkeys in CAknForm
    By straylamb in forum Symbian User Interface
    Replies: 7
    Last Post: 2009-09-24, 10:30
  2. Replies: 1
    Last Post: 2008-07-25, 14:41
  3. Can't we change the text of EAknCmdExit menu item ?
    By ashbhatia in forum Symbian User Interface
    Replies: 1
    Last Post: 2002-10-11, 14:16

Posting Permissions

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