All flavors of Symbian so far offer a nice class CEikColumnListBox which implements a list box with columns that can scroll horizontally as well as vertically. What this list box does not offer however are column titles.
This is why I wrote a class CDreamColumnListBox implementing a list box with columns and column headers. I wrote it for UIQ 2.1 and tested it with the UIQ emulator; adapting it to other Symbian UI variants should be no problem.
The sample application offered for download includes the complete source code so that you can take the list box class and use it in other applications and further customize it. (As the sample application does not do anything really useful on itself, there is no .pkg file for installing it on a real device, and no binaries.)
For showing the list box in action the sample application lists all the installed fonts and some information about them.
Implementation
The column headers itself are implemented by a little helper control class called CDreamListBoxHeader which keeps a list of the column headers, their positions and widths, and is able to draw the header strings at positions that are modified by an offset, for supporting the horizontal scrolling of the list box.
My first attempt for the list box was to directly subclass CEikColumnListBox and somehow glue my new header control to the top of it by pretending that the list box as a compound control then had one more control to the 3 that it already has. But I got into trouble managing the new height of the list box including the header control and the position of the box.
So I implemented a conventional compound control instead with two children, the header control and the list box. I duplicated the most important procedures for configuring the list box, but for all other purposes just made available the "real" list box to the outside.
The only somewhat tricky part was synchronizing the display of the headers with the horizontal scrolling of the list box. The only way that I found to do this was subclassing CEikColumnListBox nevertheless to get access to the protected method HandleScrollEventL and track the thumb position of the scroll bar involved.
Download
DreamBoxSource.zip |