I don't think it makes sense to delete and re-create the listbox every time the framework calls SizeChanged() on the container. It should be enough to create the listbox once in the ConstructL() and then call DrawDeferred() in SizeChanged(). There was also a call to a leaving function in SizeChanged() which is non-leaving. I added a TRAP_IGNORE just to cover it up, but the whole thing should be fixed.
Also calling DrawNow() at the end of ConstructL() is not a good idea. Window server will draw the the container in due time, you should not force it. You should try to avoid ever calling DrawNow() unless it is really necessary.
This is not a very good example of how listboxes should be used.
- Marko
This article represents code snippest to create a simple list box in Symbian C++. May be this article does not provides a very good example according to Mr. Marko, but I think some articles are specially meant for beginner for understanding some basic concepts. Creativity and perfection comes after when your fundamental concepts are clear.
ListBox is a primary feature of an application. List box is a GUI element which is made up of multiple text-boxes elements and used to select one item form many. This article represnts a quick guide for how we can create a simple list box following by the code snippests to do so.
This article can be very useful to beginners.
--Deepikagohil 13:45, 27 September 2009 (UTC)