Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 21st, 2004, 11:18 AM
Registered User
 
Join Date: Sep 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default TreeView OLEDrag selection

I have a MS TreeView that I have enabled OLEDragnDrop. It works great but there is a small problem with selection of the dragged node.

If a user left clicks a node to select it, then drags it, it works fine but if the the user simply clicks and drags, the selection highlight remains on the previously selected node instead of the dragged node. Unfortunately, I need the key value from the dragged node to do a DB thing in the background so I need the drag operation to first perform a selection.

Anyone help?

 
Old September 21st, 2004, 01:56 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Alameda, ca, USA.
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use the MouseDown event to select the item under the mouse (use the HitTest method). A better what to do this is to start a drag only if the item under the mouse is the selected item.

Marco
 
Old September 22nd, 2004, 06:58 PM
Registered User
 
Join Date: Sep 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks marco, I found the HitTest method later yesterday and incoporated it. Works great. I will have a look at your suggestion regarding not doing the drag unless the mouse is over the selected item.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Treeview dkr72 VBScript 0 November 9th, 2004 12:07 PM
treeview MANOJMETAL ADO.NET 1 April 17th, 2004 08:46 AM
treeview suzila Javascript 1 December 3rd, 2003 07:07 AM
TreeView surendran Classic ASP Basics 2 October 30th, 2003 06:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.