Scroll bar not visible in listbox

Login to reply to this topic.
Wed, 2005-08-10 08:01
Joined: 2005-07-28
Forum posts: 14
Hi,

I am trying to have a list box with a vertical scroll bar. My list boxt is getting created and I can move the focus by arrow keys. But the scroll bar is not getting visible. Can any one help me in finding what I am doing wrong. I checked almost all the codes available here, but didnt find any hint of it.

My listbox is created as follows:

iListBox = new (ELeave) CAknSingleStyleListBox();
   iListBox->SetListBoxObserver( this );
    iListBox->SetContainerWindowL(*this);
   iListBox->SetMopParent(this);
   iListBox->SetListBoxObserver(this);
   TResourceReader reader;
    iEikonEnv->CreateResourceReaderLC(reader, R_MYLISTBOX_SINGLE_1);   
   iListBox->ConstructFromResourceL(reader);

   // creates scroll bar
   iListBox->CreateScrollBarFrameL( ETrue );   
   iListBox->ScrollBarFrame()->SetScrollBarVisibilityL (
                                                 CEikScrollBarFrame::EOff,
                                                 CEikScrollBarFrame::EOn );   
   iListBox->ActivateL();
    iListBox->DrawNow();
   
   CleanupStack::PopAndDestroy();

Where  iListBox is defined as CEikListBox* iListBox;

The resource file reads like this :

//-----------------------------------------------------------------------------
//
//    r_mylistbox_single_1
//    ListBox( Single )
//
//-----------------------------------------------------------------------------
//
RESOURCE LISTBOX r_mylistbox_single_1
    {
    array_id = r_mylistbox_item_single1;
    flags = EAknListBoxSelectionList;
    }
// -----------------------------------------------------------------------------
//
// r_mylistbox_item_single1
// Item array for my listbox
//
//------------------------------------------------------------------------------
//
RESOURCE ARRAY r_mylistbox_item_single1
   {
   items =
      {
      LBUF{txt = qtn_mylist_item1;},
      LBUF{txt = qtn_mylist_item2;},
      LBUF{txt = qtn_mylist_item3;},
      LBUF{txt = qtn_mylist_item4;},
      LBUF{txt = qtn_mylist_item5;},
      LBUF{txt = qtn_mylist_item6;},
      LBUF{txt = qtn_mylist_item7;},
      LBUF{txt = qtn_mylist_item8;},
      LBUF{txt = qtn_mylist_item9;},
      LBUF{txt = qtn_mylist_item10;}
      };
   }

I am calling CreateList() in my container constructL(). Everything is going fone without the scroll bar. Please reply.

Fri, 2005-11-11 21:04
Joined: 2005-01-12
Forum posts: 8
Re: Scroll bar not visible in listbox
Hi,

For UIQ you need to call HandleItemAdditionL after modifying the model contents.  It will then correctly draw the scrollbars, etc.  I presume the similar is required for series 60, etc.

Best regards,

Mark Hagood
Sat, 2005-11-19 04:35
Joined: 2005-07-28
Forum posts: 14
Re: Scroll bar not visible in listbox
Hi,

I found the problem. I have been using SDK 2.0 nad it doest have the vertical scroll bar as default. Actually the scroll bar is coming with the piece of code, i wrote and its the default scroll bar for 2.0, shown below the manu pane, in small triangular form. From SDK 3.0, the vertical scroll bar is the default one.

Brs,
OJ
  • Login to reply to this topic.