Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

(VB6)  Making drag and drop less sensitive

Posted on 2003-03-27
5
Medium Priority
?
292 Views
Last Modified: 2008-11-29
Greetings.

I have an application which has a treeview and a file list box on it.  I have enabled OLE drag and drop between the two so I can move files around in the box, and drag folders willy nilly from place to place, thereby rearranging the collection of folders displayed.

My problem is that my drag and drop operations are extremely sensitive, sometimes to the point that when I click on a folder name, if my mouse continues to move past the folder I've just selected, it assumes I've started a drag operation, when that wasn't what I meant to do.

What I'd like is a way to pause the code that checks the mouse button state for about a half a second before it performs the check on the mouse button state.

It seems to me that there's a pause command I can insert into the code, but I can't seem to find it documented anywhere, and I'm probably having a brain cramp.  But my cramp is worth 50 points, so comment away.

Thanks.
Jzal
0
Comment
Question by:Jzaltheral
  • 3
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
SilentRage earned 200 total points
ID: 8221841
no way dude, that's not the best plan.  I've had the same problem as you, and found this other solution.  First of all, you gotta make your drag and drop operation manual.  Then in your MouseDown event, save the X,Y in the tag of the control you're dragging.  Then, in the MouseMove event, check to make sure button = 1 and that you have a TAG value.  Extract the XY from the tag and compare it to the current XY.  If you have moved away from the original spot by 10 pixels or so, Start dragging.  Otherwise, dont' start dragging.

The result is that when you press the left mouse button over teh control - it won't drag until you actually move your mouse away from the original spot you clicked down on.

If you need example code just ask.  :)
0
 
LVL 2

Author Comment

by:Jzaltheral
ID: 8222217
Actually my problem is exactly the oppisite.  I want to NOT drag an item just because I moved the mouse a bit when I was trying to select an item (I'm a notoriously sloppy clicker, especially with my trackball) and when I select an item, the app starts dragging when I didn't mean it to.

Jzal
0
 
LVL 1

Expert Comment

by:SilentRage
ID: 8225013
that's what I'm saying.  Don't make the slip amount only a little.  If you want, you can make it not start OLE drag until you mouse drag like 100 pixels away from the original mouse down point.
0
 
LVL 2

Author Comment

by:Jzaltheral
ID: 8226678
Ok...now I think I see what you're saying. At first blush, I didn't quite understand what you were getting at. Let me give that a try tonight when I get home for work.  I'll definately post here how it goes and if it works.

Jzal
0
 
LVL 2

Author Comment

by:Jzaltheral
ID: 8232540
Silent,

Good suggestion - that seems to be working the way I wanted much better now.  It's going to take some tweaking to get it exactly the way I want it, but you earned the points.

Thanks for the assistance.

Jzal
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

571 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