Dragging and dropping with buttons
Dragging and dropping with buttons
Dragging and dropping with buttons
Dragging and dropping with buttons
Dragging and dropping with buttons
Dragging and dropping with buttons Dragging and dropping with buttons Dragging and dropping with buttons Dragging and dropping with buttons Dragging and dropping with buttons Dragging and dropping with buttons Dragging and dropping with buttons Dragging and dropping with buttons
Dragging and dropping with buttons Dragging and dropping with buttons
Dragging and dropping with buttons
Go Back  Xtreme Visual Basic Talk > > > Dragging and dropping with buttons


Reply
 
Thread Tools Display Modes
  #1  
Old 04-29-2003, 12:11 PM
Digby Digby is offline
Freshman
 
Join Date: Apr 2003
Posts: 27
Default Dragging and dropping with buttons {RESOLVED}


How do I determine which button was used to drag and drop a file? I have this code:


Private Sub lstFileName_OLEDragDrop(Data As DataObject, Effect _
as Long, Button As Integer, Shift As Integer, X As Single, Y As Single)

If Button = vbRightButton Then
PopupMenu mRightDrag
Else
'left drag
End If


... which is meant to allow normal drag&drop with the left mouse button, but show the mRightDrag menu if the right button was used. However, whichever button I use, the value of Button passed to the sub is 0. Is that because by the time a drop is completed the button has been released, and if so, what's the point of the Button parameter?



Resolution:
I'm using the OLEDragOver event to catch the button and save it in a public variable for use when the OLEDragDrop event triggers.

Last edited by Digby; 04-29-2003 at 12:51 PM.
Reply With Quote
  #2  
Old 04-30-2003, 07:25 AM
Daraja's Avatar
Daraja Daraja is offline
Junior Contributor
 
Join Date: Apr 2003
Location: Amsterdam, Holland
Posts: 230
Default

I tried your code and the Button Parameter Function does seem kind of useless... I should do it like this:

Set the OLEDragMode from lstFileName to 1 - Automatic. The next thing you need to do is add this code:

Code:
Private Sub lstFilename_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
PopupMenu mRightDrag
Else
'Dragging is allowed
End If
End Sub
Note: I think you will know... but still. You should also set the OLEDropMode of the place you're gonna drop to 2 - Automatic.

Hope this is a solution to your problem...
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Dragging and dropping with buttons
Dragging and dropping with buttons
Dragging and dropping with buttons Dragging and dropping with buttons
Dragging and dropping with buttons
Dragging and dropping with buttons
Dragging and dropping with buttons Dragging and dropping with buttons Dragging and dropping with buttons Dragging and dropping with buttons Dragging and dropping with buttons Dragging and dropping with buttons Dragging and dropping with buttons
Dragging and dropping with buttons
Dragging and dropping with buttons
 
Dragging and dropping with buttons
Dragging and dropping with buttons
 
-->