首 页 | 新 闻 | Symbian | Windows Mobile| J2ME | 下载中心 | 游戏策划 | 购书指南 | 移动开发视频教程
您现在的位置: 开发视界 >> Symbian英文资料 >> User Interface >> 文章正文
A Multi-Column List Box with Column Headers
作者:佚名    文章来源:转载    更新时间:2006-8-18 9:35:15

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.

(GIF)

(GIF)

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

Zip - 8.5 kb
DreamBoxSource.zip
相关文章:
My experiences making a Task Manager
Cleanup support for ResetAndDestroy()
DBMS Panics
Creating a CAknSettingItemList in a Dialog
How to handle Focus On Controls on Down and Up Errow in Nokia Series60 Platform
Creation of a high score table (Part III): Display in a ListBox
List the files from a Directory
My experiences making a Task Manager