473,386 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

problem with drag and drop

hi all

i have a user control which consumes the doubleclick event.
when i use this control and implement drag and drop functionality, i.e. on
mousedown check that the left button has been pressed, the DoDragDrop(...
Problem is, because DoDragDrop is always called when the left Mouse button
is pressed, the double click in the user control isn't being fired?

any ideas?

TIA
Sam Martin
Nov 16 '05 #1
4 4787
The DoDragDrop is likely capturing the mouse, so the control never gets the
second mouse click.
One solution is to use a timer. On the left mouse down you enable the timer
(which can go off after a duration no less than
SystemInformation.DoubleClickTime), when the double click event is raised
you disable the timer and perform your double click processing. When the
timer goes off, you know you should begin dragging.

Hope that helps.
John

"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
hi all

i have a user control which consumes the doubleclick event.
when i use this control and implement drag and drop functionality, i.e. on
mousedown check that the left button has been pressed, the DoDragDrop(...
Problem is, because DoDragDrop is always called when the left Mouse button
is pressed, the double click in the user control isn't being fired?

any ideas?

TIA
Sam Martin

Nov 16 '05 #2
about to find out if that works mate
thanks

"John Wood" <sp**@isannoying.com> wrote in message
news:%2*****************@TK2MSFTNGP12.phx.gbl...
The DoDragDrop is likely capturing the mouse, so the control never gets the second mouse click.
One solution is to use a timer. On the left mouse down you enable the timer (which can go off after a duration no less than
SystemInformation.DoubleClickTime), when the double click event is raised
you disable the timer and perform your double click processing. When the
timer goes off, you know you should begin dragging.

Hope that helps.
John

"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
hi all

i have a user control which consumes the doubleclick event.
when i use this control and implement drag and drop functionality, i.e. on mousedown check that the left button has been pressed, the DoDragDrop(... Problem is, because DoDragDrop is always called when the left Mouse button is pressed, the double click in the user control isn't being fired?

any ideas?

TIA
Sam Martin


Nov 16 '05 #3
ok, the timer idea didn't work, as the DoDragDrop returned immediately,
would appear that it has to be called on a mouse
event...understandably...but thanks for the help...it gave me another idea
by using the mouse position

if anyone has the same problem....

i simply, create a member var (boolean) to hold whether or not the mouse
button was down.

i.e. on mouse down, check to make sure the left mouse button was pressed and
set the var = true
on the doubleclick and mouseup events set the var = false
on the mouse move event ...
if var==true
DoDragDrop(...

it works well, if anyone has the same problem i can email you code extract

thanks john anyway

sam

"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:O1**************@tk2msftngp13.phx.gbl...
about to find out if that works mate
thanks

"John Wood" <sp**@isannoying.com> wrote in message
news:%2*****************@TK2MSFTNGP12.phx.gbl...
The DoDragDrop is likely capturing the mouse, so the control never gets the
second mouse click.
One solution is to use a timer. On the left mouse down you enable the

timer
(which can go off after a duration no less than
SystemInformation.DoubleClickTime), when the double click event is raised
you disable the timer and perform your double click processing. When the
timer goes off, you know you should begin dragging.

Hope that helps.
John

"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
hi all

i have a user control which consumes the doubleclick event.
when i use this control and implement drag and drop functionality,

i.e. on mousedown check that the left button has been pressed, the DoDragDrop(... Problem is, because DoDragDrop is always called when the left Mouse button is pressed, the double click in the user control isn't being fired?

any ideas?

TIA
Sam Martin



Nov 16 '05 #4
hmm ok, one thing worth mentioning -- to be consistent with everything else
in windows, you should only initiate the drag when the mouse moves beyond
the SystemInformation.DragSize in pixels from the mouse down position.

"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:Of**************@TK2MSFTNGP11.phx.gbl...
ok, the timer idea didn't work, as the DoDragDrop returned immediately,
would appear that it has to be called on a mouse
event...understandably...but thanks for the help...it gave me another idea
by using the mouse position

if anyone has the same problem....

i simply, create a member var (boolean) to hold whether or not the mouse
button was down.

i.e. on mouse down, check to make sure the left mouse button was pressed and set the var = true
on the doubleclick and mouseup events set the var = false
on the mouse move event ...
if var==true
DoDragDrop(...

it works well, if anyone has the same problem i can email you code extract

thanks john anyway

sam

"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:O1**************@tk2msftngp13.phx.gbl...
about to find out if that works mate
thanks

"John Wood" <sp**@isannoying.com> wrote in message
news:%2*****************@TK2MSFTNGP12.phx.gbl...
The DoDragDrop is likely capturing the mouse, so the control never gets
the
second mouse click.
One solution is to use a timer. On the left mouse down you enable the

timer
(which can go off after a duration no less than
SystemInformation.DoubleClickTime), when the double click event is raised you disable the timer and perform your double click processing. When

the timer goes off, you know you should begin dragging.

Hope that helps.
John

"Sam Martin" <sa*********@yahoo.co.uk> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
> hi all
>
> i have a user control which consumes the doubleclick event.
> when i use this control and implement drag and drop functionality,

i.e.
on
> mousedown check that the left button has been pressed, the

DoDragDrop(...
> Problem is, because DoDragDrop is always called when the left Mouse

button
> is pressed, the double click in the user control isn't being fired?
>
> any ideas?
>
> TIA
> Sam Martin
>
>



Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: simon_s_li | last post by:
Hi, I have 5 fields in line where I need to drag and drop the text from one field to another field and then all the fields need to re-order themselves. So for instance if I drag the text in...
1
by: Oleg Medyanik | last post by:
Hi, Is there any way to drag-drop messages from Outlook 2003 into my Application (.NET based) I have not found it googling yet. The problem is that i want the messages to preserve their MSG...
2
by: SamSpade | last post by:
There seems to be two ways to put things on the clipboard ( I don't mean different formats): SetClipboardData and OleSetClipboard If I want to get data off the clipboard do I care how it was put...
4
by: zav | last post by:
Hi all i`m having a small problem with windows forms, i`m attempting to provide the following functionality to a form. Ability to drag and drop another form onto a form and then to dock this...
4
by: Qingdong Z. | last post by:
I have a VS.NET windows application which use drag-drop feather. It works fine when application start, but stops working after application run one or two days. The application is related to Video...
14
by: Nathan | last post by:
I'm working for the first time with the DoDragDrop method. I've got almost everything worked out, but I need some help with the last bit. There are two listboxes on my form, lstGroups and...
0
by: Pesso | last post by:
I'm loading a text file to a RichTextBox control to drag a selection of a text and drop it into a tree view control. It works except after the drag and drop operation the RichTextBox scrolls to the...
1
by: timnels | last post by:
I have created a muti-select treeview control. Problem is I am now trying to implement drag/drop in the application that uses it. It seems the mouse down and mouse move events fire before the...
4
by: Jeff | last post by:
Hello, I am trying to drag and drop a label control from one cell in a tablelayoutpanel to another (VB2005). There is no problem if both cells are visible, but i cannot get the tablelayoutpanel...
2
by: bob | last post by:
Hi all, I have a treeview that has drag drop. Works well enough but... If you drag out of bounds of the treeview the nodrop icon comes on. Fair enough. But when I move back inside the treeview...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.