473,756 Members | 1,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4825
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
SystemInformati on.DoubleClickT ime), 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*********@ya hoo.co.uk> wrote in message
news:%2******** ********@tk2msf tngp13.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**@isannoyin g.com> wrote in message
news:%2******** *********@TK2MS FTNGP12.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
SystemInformati on.DoubleClickT ime), 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*********@ya hoo.co.uk> wrote in message
news:%2******** ********@tk2msf tngp13.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...underst andably...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*********@ya hoo.co.uk> wrote in message
news:O1******** ******@tk2msftn gp13.phx.gbl...
about to find out if that works mate
thanks

"John Wood" <sp**@isannoyin g.com> wrote in message
news:%2******** *********@TK2MS FTNGP12.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
SystemInformati on.DoubleClickT ime), 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*********@ya hoo.co.uk> wrote in message
news:%2******** ********@tk2msf tngp13.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 SystemInformati on.DragSize in pixels from the mouse down position.

"Sam Martin" <sa*********@ya hoo.co.uk> wrote in message
news:Of******** ******@TK2MSFTN GP11.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...underst andably...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*********@ya hoo.co.uk> wrote in message
news:O1******** ******@tk2msftn gp13.phx.gbl...
about to find out if that works mate
thanks

"John Wood" <sp**@isannoyin g.com> wrote in message
news:%2******** *********@TK2MS FTNGP12.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
SystemInformati on.DoubleClickT ime), 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*********@ya hoo.co.uk> wrote in message
news:%2******** ********@tk2msf tngp13.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
3014
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 field 1 to field 3, then field 2 text and field 3 move to field 1 and field 2. I add the new order of text into an array so when the onDragEnd event
1
1912
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 format, not just get their text. (it should look like you've dropped message to MS Word). Any help is appreciated. Thanks you
2
4333
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 there? What about Drag/Drop; is there more than one way for the source to make data available Is it always OLE?
4
7270
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 form... Quite a mouthful however a good example of this is within the VS.NET 6 IDE. Grab your solution explorer panel and drop it outside of the IDE, then drag/drop it back in and watch it dock.
4
2212
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 process, CPU/Memory extensive. The drag-drop is in a new windows form. It drags from TreeView Control to other control in the same form. It cannot trigger ItemDrag event of TreeView after drag-drop feather die. Can you give me any idea? Thanks.
14
2175
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 lstStudents. I want to be able to drag a name from lstStudents and drop it on one of the names in lstGroups to move it to that group. I've got the dragging part working; it's just the dropping that isn't there yet. I'm working with what I can find...
0
1779
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 top. This is very inconvenient because after the drag-drop operation the user has to scroll down to where he was before. Is there anyway to make the RichTextBox stop jumping to the top after a drag-drop from it?
1
5015
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 OnBeforeSelect and OnAfterSelect events in the treeview. Since I want to start the drag/drop on the mouse move event, I have no clue that the current node has been selected yet. I tried moving all the code into the mouse down event (which actually...
4
3651
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 to scroll in any direction (autoscroll is on), when the cell i want to drag to is no currently visible and requires scrolling to get to see it. Any suggestions would be greatly appreciated.
2
3372
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 the nodrop icon stays on and essentially the action is cancelled when I release the mouse. I would like to somehow 'retrieve' the drag action when the mouse moves back inside the treeview to a legitimate drop point. Any thoughts on how to do this...
0
10034
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.