Simple Drag&Drop

The place for threads about version 2.x of TimoSoft ExplorerTreeView.
Post Reply
User avatar
Mex
Captain
Posts: 129
Joined: 24 Sep 2009, 19:47

Simple Drag&Drop

Post by Mex » 28 Dec 2011, 08:03

Hi

Do I need subclassing for simple Drag&Drop (Drag TreeNode and drop on Textbox)?



Best reg,
Meelis

User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: Unterföhring
Contact:

Re: Simple Drag&Drop

Post by TiKu » 28 Dec 2011, 23:07

Hi,

the drag'n'drop sample uses SubClassing for better Unicode support. The native tree view control sends a WM_NOTIFYFORMAT message to its parent window in order to decide whether to send Unicode notifications or ANSI notifications. Since the parent window is the VB6 form, it responds with "I want ANSI notifications". Since these notifications are handled by the ExplorerTreeView control (via message reflection), the desires of the VB6 form can be ignored. However, the native tree view control will send ANSI notifications because of the VB6 form's response. So the VB6 sample projects subclass the form and make the native tree view send another WM_NOTIFYFORMAT. This message is intercepted and reflected back to the ExplorerTreeView control which will properly decide for Unicode or ANSI notifications.

So, in short, this subclassing has an effect on any notification message that exists in Unicode and ANSI variants. These are:
  • TVN_BEGINDRAG (ItemBeginDrag event)
  • TVN_BEGINLABELEDIT (StartingLabelEditing event)
  • TVN_BEGINRDRAG (ItemBeginRDrag event)
  • TVN_DELETEITEM (FreeItemData event)
  • TVN_ENDLABELEDIT (RenamingItem event)
  • TVN_GETDISPINFO (ItemGetDisplayInfo event)
  • TVN_GETINFOTIP (ItemGetInfoTipText event)
  • TVN_ITEMCHANGED (ItemSelectionChanged event, ItemStateImageChanged event)
  • TVN_ITEMCHANGING (ItemSelectionChanging event, ItemStateImageChanging event)
  • TVN_ITEMEXPANDED (CollapsedItem event, ExpandedItem event)
  • TVN_ITEMEXPANDING (CollapsingItem event, ExpandingItem event)
  • TVN_SELCHANGED (CaretChanged event)
  • TVN_SELCHANGING (CaretChanging event)
  • TVN_SETDISPINFO (ItemSetText event)
You'll lose Unicode support for these events, if you remove the subclassing. For ItemBegin(R)Drag this doesn't seem to be a problem, because Windows doesn't seem to do anything string-related on these notifications. But you might run into trouble if you also use one of the other events.

Regards
TiKu
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!

Post Reply