从“树控件"编辑框中删除节点 [英] Delete Node From Tree Control throgh Edit Box

查看:92
本文介绍了从“树控件"编辑框中删除节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在编辑框中写一些文本,如果编辑框文本和树控件与项目(节点或根)相匹配,然后从树控件中单击按钮编辑框搜索项,然后从树中删除该项目,请回复我的紧急

we write some text in edit box and click on button edit box search item from tree control if edit box text and tree control item matches item( node or root) then delete item from tree plz reply me its urgent

推荐答案

使用以下方法对CTreeCtrl进行迭代:CTreeCtrl :: GetChildItem,CTreeCtrl :: GetNextItem,...

比较编辑框中的文本和树项目:
-CEdit :: GetWindowText以获取编辑框的文本.
-CTreeCtrl :: GetItemText以获取树项的文本.

文本相同时删除该项目:
-CTreeCtrl :: DeleteItem

看看MSDN上CTreeCtrl的文档.

(我将在练习中保留有关文档和示例/教程的信息.)
Iterating the CTreeCtrl is done with the methods : CTreeCtrl::GetChildItem, CTreeCtrl::GetNextItem, ...

Comparing the text in the edit box and the tree item :
- C:GetWindowText to get the text of the edit box.
- CTreeCtrl::GetItemText to get the text of the tree item.

Removing the item when the texts are identical:
- CTreeCtrl::DeleteItem

Have a look at the documentation for the CTreeCtrl on MSDN.

(I''ll leave googling for the documentation and example/tutorial as an exercise).


Sir Plz一步一步告诉我它是如何工作的.我是mfc plz先生,我是新人回复我我在哪里写ctreeCtrl的代码预先感谢
Sir Plz Tell me step By Step How its working .I m new in mfc plz sir reply me where i write code of ctreeCtrl Thanks in advance


现在,我很高兴我没有花时间讨论Tree Control索引....

我建议您阅读并理解Max提到的功能的文档.

至于步骤...

1.获取下一个控件(开始时将是第一个).
2.检查文本.匹配吗?如果是这样,您就完成了.
3.有孩子吗?如果是这样,获取第一个孩子的句柄并递归到#1.
4.然后结束?如果是这样,则退出.找不到匹配项.
5.转到#1
Now I''m glad I didn''t take the time to discuss Tree Control indexing....

I recommend you read and understand the documentation for the functions that Max mentioned.

As to the steps...

1. Get the next control (Will be the first at start).
2. Examine the text. Does it match? If so you''re done.
3. Are there children? If so, get the handle of the first child and recurse to #1.
4. At then end? If so, then quit. No match found.
5. Go to #1


这篇关于从“树控件"编辑框中删除节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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