When and how is DragDetect useful?
Basically I need something to determine if the user in the process of a drag and drop action to determine when to suppress over zealous default behavior of the CTreeCtrl
label editing in an extended multi-select tree control.
CWnd::DragDetect
returns true when the user has moved the mouse outside of a defined rect with the left button down. I was thinking of using the return value of this in ::OnMouseMove
to determine if a drag operation is in progress to enable or disable certain GUI effects and actions.
Sounds all well and good but does this really accomplish anything more than taking the same mouse point and simply doing a hit test with the selected item? I al开发者_运维技巧ready have to do a hit test for drop targets anyway so it seems like a wholly unnecessary method.
Google didn't turn up any examples of using this method and SO also returned no results so I'm curious when and if this is ever a useful method or if this is not the intended use.
Has anyone used this before?
The intent is to call DragDetect
from your WM_LBUTTONDOWN
handler to see if the user is trying to drag something from your application. If it returns true, this is the start of a drag operation; if it's false, then not. After a return of true you start tracking the mouse and doing hit tests to provide feedback, if any; you should at least change the cursor at this point. Finally at WM_LBUTTONUP
you do a final hit test to see what the drop target is.
精彩评论