A Multi-Column List Box with Column Headers
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.








A Multi-Column List Box with Column Headers
hi Brunner,
thanks for ur article.actually dis is a timely help for me.we are also trying to do the same thing but on series 60.so, is it possible to do the samething on series 60? can i get horizontal n vertical scrollbars over der?
thanking you
A Multi-Column List Box with Column Headers
I did a quick but not complete test of an early version of the sample program on S60 (without building the font list). It seemed to run after a small correction in the code (the method to create a CEikColumnListBox seems to have one or two parameters less on S60, don't ask me why), and the list box did not seem to draw a border itself as it does on UIQ. I don't know about the scroll bars, I did not check that.
So I suggest to just take the code and try on S60, chances are good that you can get it working.