如何在treeview中检索子项文本 [英] How to retrieve the child items text in treeview

查看:114
本文介绍了如何在treeview中检索子项文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个树形视图,我用一些值填充它。现在我的树视图有一个Root节点和一个子节点反过来,子节点由三个子项组成,我在树视图下面的对话框中有一个按钮,当我选择有3个子项的子节点时,我必须得到一个指向根节点的副本。



[+]美国





[+]印度

..AP

..MP

..MH

现在当我选择INDIA时然后按下按钮然后我必须能够将它的副本添加到America并且看起来像是,



[+] America

。 。

。 。

。 。

。 [+]印度

。 ...... AP

。 ...... MP

。 ...... MH







.... [+]印度[2]

.... AP [2]

.... MP [2]

.... MH [2]



这是我必须得到的但当我点击按钮时它只是添加了INDIA而我无法获得子项目,即(AP,MP, MH)。



我通过使用SendDlgItemMessage(hWnd,IDC_TREE,TVM_GETITEM,TVGN_CARET,(LPARAM)&tvItem)发送消息来获取当前所选项目;



我尝试通过发送一条消息来获取子项目,即



SendDlgItemMessage(hWnd,IDC_TREE,TVM_GETITEM,TVGN_CHILD ,(LPARAM)&tvItem);

但它仍然显示所选项目但不显示子项目文本值。



因为我是新的win32编程被困在这里。



任何人都可以帮助我。



在此先感谢,

siva V

解决方案

Hi,

I had a tree view where i had populated it with some values.Now my Tree view has a Root node and a sub node for it and in turn the sub node consists of three child items and i had a button in a dialog beneath the tree view and when i select the sub node that had 3 child items i must get a copy of that which will be pointing out to the root node.

[+]America
.
.
[+]INDIA
..AP
..MP
..MH
and now when i select "INDIA" and press the button then i must be able to add a copy of that to "America" and which would look like,

[+]America
. .
. .
. .
. [+]INDIA
. ...AP
. ...MP
. ...MH
.
.
.
....[+]INDIA[2]
....AP[2]
....MP[2]
....MH[2]

This is what i have to get but when i am clicking the button it is just adding the INDIA and i was unable to get the child item i.e,(AP,MP,MH).

I am getting the current selected item by sending message using SendDlgItemMessage(hWnd,IDC_TREE,TVM_GETITEM,TVGN_CARET,(LPARAM)&tvItem);

I tried getting the child item by sending one more message i.e,

SendDlgItemMessage(hWnd,IDC_TREE,TVM_GETITEM,TVGN_CHILD,(LPARAM)&tvItem);
but it is still showing the selected item but not the child items text value .

As i am new win32 programming got stuck over here .

Can anyone kindly help me .

Thanks in advance,
siva V

解决方案

这篇关于如何在treeview中检索子项文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆