TreeListCtrl

wxTreeListCtrl

Official ClassesSmallBlocks.pngArchive  Containers  Controls  Data Structures  Database  Date & Time  Debug  Device Contexts  Dialogs  Document & Views  Drag & Drop Events  Filesystem  Frames  Graphics  Grid Cell  Help  HTML  Logging  Miscellaneous  Networking  Printing  Sizers  Streams  Threading Windows

A control combining wxTreeCtrl and wxListCtrl features.

This is a multi-column tree control optionally supporting images and checkboxes for the items in the first column.

It is currently implemented using wxDataViewCtrl internally but provides a much simpler interface for the common use case it addresses. Thus, one of the design principles for this control is simplicity and intentionally doesn't provide all the features of wxDataViewCtrl. Most importantly, this class stores all its data internally and doesn't require you to define a custom model for it.

Instead, this controls works like wxTreeCtrl or non-virtual wxListCtrl and allows you to simply add items to it using wxTreeListCtrl::AppendItem() and related methods. Typically, you start by setting up the columns (you must have at least one) by calling wxTreeListCtrl::AppendColumn() and then add the items. While only the text of the first column can be specified when adding them, you can use wxTreeListCtrl::SetItemText() to set the text of the other columns.

Unlike wxTreeCtrl or wxListCtrl this control can sort its items on its own. To allow user to sort the control contents by clicking on some column you should use wxCOL_SORTABLE flag when adding that column to the control. When a column with this flag is clicked, the control resorts itself using the values in this column. By default the sort is done using alphabetical order comparison of the items text, which is not always correct (e.g. this doesn't work for the numeric columns). To change this you may use SetItemComparator() method to provide a custom comparator, i.e. simply an object that implements comparison between the two items. The treelist sample shows an example of doing this. And if you need to sort the control programmatically, you can call SetSortColumn() method.

Here are the styles supported by this control. Notice that using wxTL_USER_3STATE implies wxTL_3STATE and wxTL_3STATE in turn implies wxTL_CHECKBOX.

WARNING: since version 2.9, wxWidgets includes its own wxTreeListCtrl. That is NOT the same as the wxCode one.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值