TreeView DoubleClick: Change Behavior

Posted on 2006-03-24
Medium Priority
Last Modified: 2013-12-25
I need to change the behavior when I double-click on a node in tree view.

When a user double-clicks on any node in the tree, that element is added to a list.

Whatever the state of the node is before the double-click I want that to remain the same after the double-click.  So if the node is expanded I want it to stay expanded and if the node is collapsed I want it to stay collapsed.

How do I do this?

Currently my code adds the element to the list but the state of the node changes which is a bit confusing to the user.

Question by:dastrw
  • 2
LVL 15

Accepted Solution

Computron earned 1000 total points
ID: 16284162
You can subclass it

TVEventCancel: Demonstrates how to prevent a Node selection change, expand, and collapse in the Comctl32.ocx TreeView control


LVL 19

Assisted Solution

BrianGEFF719 earned 1000 total points
ID: 16285735
computron, you've really gone into over drive this month on the answering questions....

Computron has provided a good suggestion: subclass. However, you should understand the problems that can arise from subclassing such as: It makes it extremly difficult to debug your applications. Perhaps you should consider a more robust tree view control. Such as one from VBAccelerator.

LVL 19

Expert Comment

ID: 16285739

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month16 days, 5 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question