Got a bit of a problem. Was playing around with listboxes and created a CAknSingleNumberStyleListBox, which I got to work quite nicely, but then I decided to try out CAknDoubleNumberStyleListBox, and here's where I bumped into the problem. It works fine, apart from the scoll indicators which are nowhere to be seen.
The only thing I changed was the class I use for the listbox (and the formatting of the items of course).
I call CreateScrollBarFrameL() and SetScrollBarVisibilityL() as normal, and I call SetMopParent() when creating my container. Anyone got any ideas what could be missing?
If I switch back to CAknSingleNumberStyleListBox the scroll indicators appear again. Is the double style one a special case or something?
Thanks for the help guys, but it still doesn't seem to work I'm afraid. Tried calling both SetMopParent() and UpdateScrollBarsL(),
but still no scroll indicators. Here's the code. As far as I can see it should work fine, but maybe I've missed something:
iListbox = new (ELeave) CAknDoubleNumberStyleListBox;
iListbox->SetContainerWindowL(*this);
iListbox->SetMopParent(this);
Any thoughts? The only thing I can think of is that maybe some of the functions need to be called in different order, but I've tried a bunch of combinations already, including creating the scrollbar before adding the items and after SetRect(). Ah well, nothing is ever simple is it? :-)
I assume that your listbox is in some kind of container which is created in the AppUi class or a view class.
In this class you also have to do something like this:
iContainer = new (ELeave) CYourContainerClass();
iContainer->SetMopParent(this);
iContainer->ConstructL(... whatever ...);
If you don't set the MopParents from the elemet that owns the area where the scroll indicators are painted down to the ListBox, you will never get the Scrollbars.
Yep, the code is from the ConstructL() of my container class, which is instantiated in my AppUi class, and yes, I do call SetMopParent() on the container class just as in your example.
And that's the bugger, it should work shouldn't it? It does seem to work for some listbox classes. In fact, by the looks of it single style listboxes do not seem to have any problems with the scroll indicators. I get them to display even without calling SetMopParent() and UpdateScrollBarsL() on the listbox, but as soon as I change to a double style list, poof! the scroll indicators are no more.
Hi,
I've the same kind of problem with a DoubleStyleListBox. I can't see the scrollbar.
I tried to follow the directions of this thread, but the problem remains.
Did you find a solution?
Thanks
Have you tried calling the setmop parent also for the container in which your listbox is in. I.e. inside your view class for example. And then not calling the set mop parent for the listbox.
The problem is that the SetMopParent() in the AppUi is called after the listbox has been constructed. I have two solutions that worked for me:
1.) call SetMopParent() for the container inside ConstructL() of the view:
void CHelloWorldAppView::ConstructL(const TRect& aRect)
{
// Create a window for this application view
CreateWindowL();
SetMopParent(iEikonEnv->EikAppUi());