×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    1

    List Box Flickers badly on populating

    Hi All,
    I have been facing a problem of flicker in the listbox whenever I populate it and after sometime settles down........Following below are the snippets I used in the Container:

    void CMessageTextListBox::ConstructL(CCoeControl* aWindowOwningContainer,TRect aRect)
    {

    SetContainerWindowL(*aWindowOwningContainer);

    // Application title
    iAppTitle = CCknAppTitle::NewL(CCknAppTitle::EWindow);
    iAppTitle->SetContainerWindowL(*this);
    iAppTitle->SetTextL(*iEikonEnv->AllocReadResourceL(R_TAB_INBOX), CCknAppTitle::EMainTitle);


    iListbox = new(ELeave)CCustomListBox();

    iListbox->ConstructL(aWindowOwningContainer,
    CEikListBox::ENoExtendedSelection);


    iListbox->CreateScrollBarFrameL(ETrue);

    iListbox->ScrollBarFrame()->SetScrollBarVisibilityL(
    CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);

    SetIconsArray();

    SetData();

    }



    void CMessageTextListBox::SetData(TInt aIsmark)
    {
    CDesCArrayFlat* listItems;

    Put all the items in listitems first and later to listbox
    .............................................................

    .........................................................
    CTextListBoxModel* model = iListbox->Model();
    model->SetItemTextArray(listItems);

    if(iCursorPos >= 0)
    iListbox->SetCurrentItemIndex(iCursorPos);

    iListbox->HandleItemAdditionL();

    model->SetOwnershipType(ELbmOwnsItemArray);

    }


    void CMessageTextListBox::SetIconsArray()
    {
    // Creates a new icon array.
    CArrayPtr<CGulIcon>* iconArray = new (ELeave) CArrayPtrFlat<CGulIcon>(3);

    CleanupStack::PushL(iconArray);

    ................................................................
    file to read the mbm

    iconArray->AppendL( CEikonEnv::Static ()->CreateIconL( .................. );



    CleanupStack::Pop(); // iconArray

    // Sets the icon array.
    CCustomListItemDrawer* itemDrawer = static_cast<CCustomListItemDrawer*>
    (iListbox->View()->ItemDrawer());

    itemDrawer->SetIconArray(iconArray); // transfer ownership

    // Sets the height of the list box item
    TSize size = itemDrawer->MaxIconSize();
    iListbox->SetItemHeightL(2 * size.iHeight);
    }


    void CMessageTextListBox::Draw(const TRect& aRect) const
    {

    CWindowGc& gc = SystemGc();
    gc.SetClippingRect(aRect);
    ////gc.Clear(iBorder.OuterRect(aRect));
    gc.SetBrushStyle(CGraphicsContext::ESolidBrush);

    if (IsFocused())
    {
    CEikBorderedControl::Draw(iBorder.OuterRect(aRect)); // Shadow border
    gc.SetBrushColor(TRgb(KFocusedBkgColor));
    }
    else
    {
    gc.SetBrushColor(TRgb(KNonFocusedBkgColor));
    }

    // Fill the controls background. The color depends on the focus status. In
    // this example this has no effect, because contained controls are drawn
    // over the same area. Here just for demonstrating design principle.
    gc.DrawRect(Border().InnerRect(Rect()));
    }


    void CMessageTextListBox::FocusChanged(TDrawNow aDrawNow)
    {
    if (IsFocused()) // This control got focus.
    {
    iAppTitle->SetFocus(ETrue, aDrawNow);
    iListbox->SetFocus(ETrue, aDrawNow);
    }
    else // This control lost focus
    {
    iAppTitle->SetFocus(EFalse, aDrawNow);
    iListbox->SetFocus(EFalse, aDrawNow);
    }
    DrawDeferred();
    }


    void CMessageTextListBox::SizeChanged()
    {
    TRect innerRect = Border().InnerRect(Rect());
    innerRect.iBr.iX = innerRect.iTl.iX + innerRect.Width();

    TRect titleRect(innerRect.iTl,
    TSize(innerRect.Width(), iAppTitle->MinimumSize().iHeight));
    iAppTitle->SetRect(titleRect);

    iListbox->SetRect(
    TRect(innerRect.iTl + TPoint(0, iAppTitle->Size().iHeight + 1),
    innerRect.iBr));

    iListbox->ActivateL();

    }


    I'm calling SetRect() from the view file............with rect size being a smaller one............the device is of series 80. Has anyone been in a similiar situation? I have also experienced a similiar flicker problem in E61 though it's a series 60 device.

  2. #2
    Registered User
    Join Date
    Dec 2006
    Posts
    6

    Re: List Box Flickers badly on populating

    Does the flicker occurs when you update the listbox?

    If so, try to use DrawNow() instead of DrawDeferred().
    That did the trick for me ;)

    cheers

Similar Threads

  1. Replies: 2
    Last Post: 2006-04-27, 07:58
  2. 6680 and bluetooth service profiles
    By ceruault in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-10-08, 22:24
  3. list box with find box - Series 60
    By white_dragon in forum Symbian
    Replies: 3
    Last Post: 2004-08-16, 09:52
  4. Replies: 1
    Last Post: 2004-03-01, 08:37
  5. List Box control on series -60
    By Nokia_Archive in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2002-05-30, 21:03

Posting Permissions

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