×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    18

    a problem to use single selectioln list

    I only want to display "Need" and "Offer" in the list box.
    So I use CAknSingleStyleListBox.
    My code is below, but unfortunately, the code cannot display the text I want to.
    Can any one tell where is the problem in the code?

    void CTxtViewerTypeList::ConstructL(const TRect& aRect)
    {
    CreateWindowL();

    SetUpListBoxL();
    ShowRootL();

    SetRect(aRect);
    ActivateL();
    }

    void CTxtViewerTypeList::SetUpListBoxL()
    {
    iListBox = new (ELeave) CAknSingleStyleListBox ();
    iListBox->SetContainerWindowL(*this);

    TResourceReader reader;
    iEikonEnv->CreateResourceReaderLC(reader, R_VIEWER_TYPE_LISTBOX);

    // Create the list box
    iListBox->ConstructFromResourceL(reader);
    CleanupStack::PopAndDestroy(); // reader


    // Add this to observe the list box
    iListBox->SetListBoxObserver(this);

    // Add vertical scroll bars (which are visible when necessary)
    // iListBox->CreateScrollBarFrameL(ETrue);
    // iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
    }

    // This adds the C and D drives
    void CTxtViewerTypeList::ShowRootL()
    {
    // Get the list box model
    CTextListBoxModel* model = iListBox->Model(); // Does not own the returned model
    User::LeaveIfNull(model);
    model->SetOwnershipType(ELbmOwnsItemArray);

    CDesCArray* itemArray = static_cast<CDesCArray*>(model->ItemTextArray());
    User::LeaveIfNull(itemArray);

    itemArray->Reset(); // Remove content from the array

    itemArray->AppendL(_L("Need"));
    iListBox->HandleItemAdditionL();

    itemArray->AppendL(_L("Offer"));
    iListBox->HandleItemAdditionL();
    iListBox->SetCurrentItemIndex(0);
    iListBox->DrawNow();

    iCurrPos = 0;
    }
    void CTxtViewerTypeList::Draw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    gc.Clear(aRect);
    }

    Here is the resource definition.
    RESOURCE LISTBOX r_viewer_type_listbox
    {
    flags = EAknListBoxSelectionList | EAknListBoxLoopScrolling;
    }

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,736

    Re: a problem to use single selectioln list

    You should implement CountComponentControls and ComponentControl.
    And iListBox->DrawNow should be a simple DrawNow.

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    18

    Re: a problem to use single selectioln list

    Quote Originally Posted by wizard_hu_ View Post
    You should implement CountComponentControls and ComponentControl.
    And iListBox->DrawNow should be a simple DrawNow.
    I have CountComponentControls and ComponentControl. There is nothing special in them, so I didn't post them.
    I also tried DrawNow, but it still doesn't work.
    Maybe I didn't express my question clearly.
    It seems the single selection list can be displayed in the screen, but it cannot display the text "Need" and "Offer", which I add to the list.
    Here is the source code.
    http://cid-f9beaac3236afa2b.skydrive...werAppView.cpp
    http://cid-f9beaac3236afa2b.skydrive...iewerAppView.h
    Actually, I was modifying the code of viewer in the MTM example.
    What I want is when some user presses the OK button in a text field, the single selection list box is displayed, just like what is done in the normal message system. while we are creating a message, we can get the contact list by pressing the OK button in the text field of destination phone numbers.

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,736

    Re: a problem to use single selectioln list

    I do not know. You can find my simplest example in http://discussion.forum.nokia.com/fo...ad.php?t=92554

  5. #5
    Registered User
    Join Date
    Apr 2008
    Posts
    18

    Re: a problem to use single selectioln list

    Quote Originally Posted by wizard_hu_ View Post
    I do not know. You can find my simplest example in http://discussion.forum.nokia.com/fo...ad.php?t=92554
    I have found the problem.
    I need to use "\tNeed" and "\tOffer" instead of "Need" and "Offer"
    Thank you for your example.

Similar Threads

  1. Problem in displaying available contacts in list
    By dineshshilpi in forum Mobile Java General
    Replies: 2
    Last Post: 2008-05-13, 11:58
  2. problem with list box
    By srkreddy999 in forum Symbian User Interface
    Replies: 2
    Last Post: 2005-09-30, 10:44
  3. List box problem
    By apitoman in forum Symbian
    Replies: 2
    Last Post: 2004-08-27, 13:50
  4. setting list problem
    By ddhungry in forum Symbian
    Replies: 0
    Last Post: 1970-01-01, 02:00
  5. setting list problem
    By ddhungry in forum Symbian User Interface
    Replies: 0
    Last Post: 1970-01-01, 02: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
  •  
×