Ctreectrl hittest usage

Source: Internet
Author: User

The hittest function of ctreectrl can obtain the items related to the current mouse position.

This function can be implemented. In the tree with a checkbox, the checkbox of the parent node is selected, and the checkbox of the child node can be automatically selected. Because the htreeitem of the parent node can be obtained, the child nodes can be traversed based on this attribute.

Void cmydlg: onnmclicktree1 (nmhdr * pnmhdr, lresult * presult)
{
// Todo: add control notifications hereProgramCode

Cpoint pt;
Uint nflags;
: Getcursorpos (& pt );
: Screentoclient (m_ctree.m_hwnd, & pt );
Htreeitem hitem = m_ctree.hittest (PT, & nflags );

Cstring smsg;
Smsg. Format (_ T ("% s"), m_ctree.getitemtext (hitem ));
Afxmessagebox (smsg );

* Presult = 0;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.