Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User koreson's Avatar
    Join Date
    Oct 2006
    Posts
    30
    Hi,

    this code creates an multi selection list box. WHY ?

    void CtestAppView::ConstructL( const TRect& aRect )
    {
    // Create a window for this application view
    CreateWindowL();
    iListBox = new (ELeave) CAknSingleNumberStyleListBox;
    iListBox->ConstructL( this, EAknListBoxSelectionList);
    iListBox->SetContainerWindowL(*this);
    SetRect(aRect);
    iListBox->CreateScrollBarFrameL(ETrue);
    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);
    MDesCArray* itemList = iListBox->Model()->ItemTextArray();
    CDesCArray* itemArray = (CDesCArray*) itemList;
    itemArray->AppendL(_L(" aaa"));
    itemArray->AppendL(_L(" bbb"));
    itemArray->AppendL(_L(" ccc"));
    itemArray->AppendL(_L(" ddd"));
    itemArray->AppendL(_L(" aaa"));
    iListBox->HandleItemAdditionL();
    iListBox->SetRect(aRect.Size());
    ActivateL();
    }


    While scrolling all items stay selected.
    New items at the bottom of the list draw its text over the existing items
    in the visible area of the list box.
    This error appears in all list box types.
    Whats wrong ???




    best regards
    Last edited by koreson; 2006-11-11 at 00:07.

  2. #2
    Super Contributor vasant21's Avatar
    Join Date
    Jul 2006
    Location
    Oulu, Finland.
    Posts
    1,174
    hi,

    Why you call ListBox->HandleItemAdditionL(); while creating your listbox.

    You can do it like this :
    iItemList = new (ELeave) CAknSingleStyleListBox();

    iItemList->SetContainerWindowL(*this);
    iItemList->SetMopParent(this);
    //EAknListBoxSelectionList();
    //iItemList->ConstructFromResourceL(R_ENTRY_SETTINGS_LIST);
    iItemList->ConstructL(this,EAknListBoxSelectionList);

    array = new (ELeave) CDesCArrayFlat(25);
    array->AppendL(_L("\tItem 1"));
    array->AppendL(_L("\tItem 2"));
    array->AppendL(_L("\tItem 3"));
    array->AppendL(_L("\tItem 4"));
    iItemList->Model()->SetItemTextArray(array);

    iItemList->MakeVisible(true);
    iItemList->SetRect(aRect);
    iItemList->ActivateL();

    iItemList->DrawNow();


    Regards,
    vasant

  3. #3
    Registered User koreson's Avatar
    Join Date
    Oct 2006
    Posts
    30
    @vasant21:
    thank you for reply.

    I do it in you way - its the same problem.
    The first item is selected at start. I scroll down all items stay selected. I want a classic list style where only one item is selected.
    Another strange behavior is that the items text "overdraw" each other while scrolling.

    Here is an error anywhere. I post the rest of the code now.
    I made a new HelloWorld application with Carbide .vs / S60 3rd ed. the list is the only ui element.
    It would make me happy we could solve this basic problem.


    void CtestAppView::ConstructL( const TRect& aRect )
    {
    // Create a window for this application view
    CreateWindowL();

    iListBox = new (ELeave) CAknSingleStyleListBox();

    iListBox->SetContainerWindowL(*this);
    iListBox->SetMopParent(this);
    iListBox->ConstructL(this,EAknListBoxSelectionList);

    iAppList = new (ELeave) CDesCArrayFlat(25);
    iAppList->AppendL(_L("\tItem 1"));
    iAppList->AppendL(_L("\tItem 2"));
    iAppList->AppendL(_L("\tItem 3"));
    iAppList->AppendL(_L("\tItem 4"));
    iAppList->AppendL(_L("\tItem 1"));
    iAppList->AppendL(_L("\tItem 2"));
    iAppList->AppendL(_L("\tItem 3"));
    iAppList->AppendL(_L("\tItem 4"));
    iAppList->AppendL(_L("\tItem 1"));
    iAppList->AppendL(_L("\tItem 2"));
    iAppList->AppendL(_L("\tItem 3"));
    iAppList->AppendL(_L("\tItem 4"));
    iListBox->Model()->SetItemTextArray(iAppList);

    iListBox->MakeVisible(true);
    iListBox->SetRect(aRect);
    iListBox->ActivateL();

    iListBox->DrawNow();

    ActivateL();
    }


    CtestAppView::~CtestAppView()
    {
    delete iListBox;
    iListBox = NULL;
    }


    void CtestAppView::HandleControlEventL(CCoeControl* /*control*/, TCoeEvent /*eventType*/)
    {
    }


    TInt CtestAppView::CountComponentControls() const
    {
    return 1;
    }


    CCoeControl* CtestAppView::ComponentControl(TInt aIndex) const
    {
    switch ( aIndex ) {
    case 0: return iListBox;
    default: return NULL;
    }
    }


    TKeyResponse CtestAppView::OfferKeyEventL( const TKeyEvent& aKeyEvent,TEventCode aType )
    {
    return iListBox->OfferKeyEventL(aKeyEvent,aType);
    }



    void CtestAppView::Draw( const TRect& /*aRect*/ ) const
    {
    }


    void CtestAppView::SizeChanged()
    {
    if(iListBox)
    iListBox->SetRect(Rect());
    }


    //AppUI

    void CtestAppUi::ConstructL()
    {
    // Initialise app UI with standard value.
    BaseConstructL();

    // Create view object
    iAppView = CtestAppView::NewL( ClientRect() );
    iAppView->SetMopParent(this);

    iAppView->SetRect(ClientRect());
    AddToStackL(iAppView);
    }

    best regards
    Daniel
    Last edited by koreson; 2006-11-11 at 12:09.

  4. #4
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    You have not mentioned that you are using 3rd edition, but I know ;-)
    So: use BaseConstructL(EAknEnableSkin) in the ConstructL of your AppUi.

  5. #5
    Registered User koreson's Avatar
    Join Date
    Oct 2006
    Posts
    30
    @wizard_hu_

    thank you. This solved my problem.

    But why the project wizard doesnt set this flag for me !?!?

    Developing for Symbian is time robbery !


    best regards
    Daniel

Similar Threads

  1. Setting Height for list box items
    By krnsoft in forum Symbian User Interface
    Replies: 2
    Last Post: 2007-04-09, 13:53
  2. Replies: 1
    Last Post: 2005-02-09, 17:58
  3. List Box in Series60
    By anupamcins in forum Symbian User Interface
    Replies: 2
    Last Post: 2004-11-20, 10:38
  4. question about selection list box
    By cavatino in forum Symbian User Interface
    Replies: 1
    Last Post: 2003-06-13, 10:51
  5. List item selection
    By SanDan in forum Mobile Java General
    Replies: 2
    Last Post: 2003-05-06, 10:57

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved