cxDBTreeList的问题!

程晨c 2012-03-26 04:22:31
看图


问题

1.如何给节点添加图标(分选中和未选中两种图标)?最好是可以像添加节点那样,在设计时就搞定,而不需在代码中实现。

2.如何实现选中行是整行选中,如上图所示。

3.双击根结点,树在展开和收缩两种状态之间切换。最好是可以像添加节点那样,在设计时就搞定,而不需在代码中实现。

目前只有这点儿分数了,暂时只能这么多分。
...全文
543 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
落幕年代 2012-05-16
  • 打赏
  • 举报
回复

1 procedure cxDBTreeList1GetNodeImageIndex(Sender:TcxCustomTreeList; ANode: TcxTreeListNode; AIndexType:
2
3 TcxTreeListImageIndexType; var AIndex: TImageIndex);
4 var
5 i :Integer;
6 begin
7 //给树结点加上图标
8 for i := 0 to ANode.ValueCount do
9 begin
10 if ANode.Level = 0 then
11 begin
12 ANode.ImageIndex := 0;
13 end
14 else
15 if ANode.Level = 1 then
16 begin
17 ANode.ImageIndex := 2;
18 end
19 else
20 if ANode.Level = 2 then
21 begin
22 ANode.ImageIndex := 1;
23 end;
24 end;
25 end;

程晨c 2012-03-27
  • 打赏
  • 举报
回复
我觉得,可以预留一个图片的imageindex的属性,虽然设计时节点树不确定,无法给买个节点指定相应的图标,但是控件可以在自己运行时,根据imageindex的值来提取对应图片给节点显示。不过cxDBTreeList没有这么做,而是提供了一个事件

GetNodeImageIndex(Sender: TObject;ANode: TcxTreeListNode; AIndexType: TcxTreeListImageIndexType;var AIndex: TImageIndex);
//anode为当前节点
//AIndexType为图表类型
//ImageIndex为图标索引
begin
if AIndexType=tlitImageIndex then
begin
AIndex :=0;
end
else if AIndexType=tlitSelectedIndex then
begin
AIndex :=1;
end;
end;



2.选中行整行选中
只需要将cxDBTreeListColumn的width加宽就可以实现这种效果。

3.cxDBTressList控件本身就带有双击根结点,树在展开和收缩两种状态之间切换的功能。
我看见佛 2012-03-26
  • 打赏
  • 举报
回复
第二个功能我不知道不写代码能否实现,第一个和第三个是要自己写代码的,第一个的话:想想就应该明白,首先:你的节点数不确实,SO……那里记得并没有指定每个节点相应图标的IMAGEINDEX,所以可以推理出来是要写代码的。

以后前这样的代码,如果要代码的话可以发个给你。

第三个功能,因为手头没手装DEV很久了,也不是很清楚具体实现方式
程晨c 2012-03-26
  • 打赏
  • 举报
回复
cxDBTreeList的object inspector中有好几个相关的image属性,设置后没起作用。
程晨c 2012-03-26
  • 打赏
  • 举报
回复
以前创建一个树都是用递归的方法操作数据表,最近发先cxDBTreeList在创建树时,可以通过数据绑定实现。

TreeView的节点图标,可以在设计时指定imaglist来实现,但是试了好多次cxDBtreeList,都没能在设计时实现

不知道是不是自己的方法有问题。
程晨c 2012-03-26
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 bdmh 的回复:]
想的挺美,连句代码都不想写,还当什么程序员
[/Quote]
不是不想写,是想看看到地cxDBTreeList跟TreeView在用法上有多大区别!
bdmh 2012-03-26
  • 打赏
  • 举报
回复
想的挺美,连句代码都不想写,还当什么程序员
程晨c 2012-03-26
  • 打赏
  • 举报
回复
需要加分吗?
刚收到朋友的捐赠分,还被扣了税!
================================== ==注意:一共2个压缩包,这是第2个== ================================== *提示:无自动安装程序,包含所有源码、例子、帮助,请按照安装顺序安装!!! New Features in 13.1.4 (VCL Product Line) Breaking Changes To learn about breaking changes in this version, please refer to the following page: Breaking Changes in 13.1.4 (VCL Product Line) Known Issues To learn about known issues in this version, please refer to the following page: Known Issues in 13.1.4 (VCL Product Line) The following sections list all minor and major changes in DevExpress VCL 13.1.4. Note that products, controls and libraries which aren't mentioned in the list below are included in the unified installer for compatibility, but have not been updated. Enhancements and Updates New Features/Updates VCL Subscription ExpressTile Control ExpressDataController Resolved Issues ExpressBars Suite ExpressLayout Control ExpressNavBar ExpressPageControl ExpressPivotGrid Suite ExpressPrinting System ExpressQuantumGrid Suite ExpressQuantumTreeList Suite ExpressScheduler Suite ExpressSkins Library ExpressSpreadSheet ExpressTile Control ExpressVerticalGrid Suite ExpressDataController ExpressEditors Library ExpressLibrary Installation (VCL) New Features/Updates VCL Subscription S170932 - Documentation - Describe that the ExpressLayout Control and ExpressDocking Library are incompatible ExpressTile Control S172299 - Center the Back button and title text vertically within the title Common Libraries ExpressDataController S172107 - Add the capability to disable multi-threaded operations at the level of custom data sources (TcxCustomDataSource descendants) Resolved Issues ExpressBars Suite Q476901 - Documentation - The "Ribbon Application Menu" topic does not contain the menu creation steps that are specific to TdxRibbonBackstageView Q452658 - Documentation - The TdxCustomRibbonGalleryItem.GalleryGroups property is not marked as deprecated and is used in topics instead of TdxCustomRibbonGalleryItem.GalleryCategories Q513198 -
================================== ==注意:一共2个压缩包,这是第1个== ================================== *提示:无自动安装程序,包含所有源码、例子、帮助,请按照安装顺序安装!!! New Features in 13.1.4 (VCL Product Line) Breaking Changes To learn about breaking changes in this version, please refer to the following page: Breaking Changes in 13.1.4 (VCL Product Line) Known Issues To learn about known issues in this version, please refer to the following page: Known Issues in 13.1.4 (VCL Product Line) The following sections list all minor and major changes in DevExpress VCL 13.1.4. Note that products, controls and libraries which aren't mentioned in the list below are included in the unified installer for compatibility, but have not been updated. Enhancements and Updates New Features/Updates VCL Subscription ExpressTile Control ExpressDataController Resolved Issues ExpressBars Suite ExpressLayout Control ExpressNavBar ExpressPageControl ExpressPivotGrid Suite ExpressPrinting System ExpressQuantumGrid Suite ExpressQuantumTreeList Suite ExpressScheduler Suite ExpressSkins Library ExpressSpreadSheet ExpressTile Control ExpressVerticalGrid Suite ExpressDataController ExpressEditors Library ExpressLibrary Installation (VCL) New Features/Updates VCL Subscription S170932 - Documentation - Describe that the ExpressLayout Control and ExpressDocking Library are incompatible ExpressTile Control S172299 - Center the Back button and title text vertically within the title Common Libraries ExpressDataController S172107 - Add the capability to disable multi-threaded operations at the level of custom data sources (TcxCustomDataSource descendants) Resolved Issues ExpressBars Suite Q476901 - Documentation - The "Ribbon Application Menu" topic does not contain the menu creation steps that are specific to TdxRibbonBackstageView Q452658 - Documentation - The TdxCustomRibbonGalleryItem.GalleryGroups property is not marked as deprecated and is used in topics instead of TdxCustomRibbonGalleryItem.GalleryCategories Q513198 -

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧