|
-
March 31st, 1999, 08:29 AM
#1
controls
I have just written a program that uses Tree views (controls).
What I want to do is to be able to launch a dialog box once the user clicks on any of the items in the Tree view. How can I do this.
Thank you very much.
-
March 31st, 1999, 08:42 AM
#2
Re: controls
Fortunately, this is one of the easy ones. Create your dialog box with the resource editor. Add a handler to your tree control using the class wizard. Then in that handler, declare your dialog and run it:
CMyTreeView::OnLClick(...)
{
CMyDialog dlg;
if(dlg.DoModal() == IDOK)
...
}
-
March 31st, 1999, 09:06 AM
#3
Re: controls
To further elaborate on Bore's answer...
Create a handler for the LButtonDown event as he mentions, and in that handler what you will want to do is use the point that is passed to you and pass it to CTreeCtrl::HitTest(). This function will tell you if the point where the mouse was clicked is actually ON an item in the tree or not, which I believe is what you really want. If you don't use the hit test, your handler will work no matter where the user clicks within the tree (in other words, NOT on an item).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|