473,322 Members | 1,425 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,322 software developers and data experts.

determinating if the mouse button is still down - again

I am try to find out how to check if the mouse button is held down.

The e.click =2 works, it allows me to enter the double click double.
I what the single click to do some different and then a click and
hold
to allow the drag and drop
I have looked at the mouseUp events be can not get it to work, when i
click and release my code does not enter mouseUP event?
See above for MouseDown Event
any ideas
Thanks
Barry
Private Sub tvNone_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles tvNone.MouseDown
Select Case e.Button.ToString
Case "Left"
If e.Clicks = 2 Then Exit Sub '# Exits to Double
click
event
If tvNone.SelectedNode Is Nothing Then Exit Sub '#
Exits if nothing is selected
'# Enable Treeview that node can be dropped into
Me.tvNone.AllowDrop = True
Me.tvRFQ.AllowDrop = True
Me.tvEnquiry.AllowDrop = False
Me.tvEval.AllowDrop = False
Me.tvRPT.AllowDrop = False
Me.tvPO.AllowDrop = False
Me.tvRAS.AllowDrop = False
Me.tvITD.AllowDrop = False
Me.tvRAD.AllowDrop = False
'# Get Selected node and node index
Dim DraggedNode As String = tvNone.SelectedNode.Text
Dim DraggedNodeIndex As Integer =
tvNone.SelectedNode.Index
'# Send info to DragDrag events
tvNone.DoDragDrop(Chr(40) & DraggedNode & Chr(41) &
Chr(40) & 0 & Chr(41), DragDropEffects.Move)
'# Remove Selected Node
tvNone.Nodes.RemoveAt(DraggedNodeIndex)
Case "Middle"
Case "Right"
End Select
End Sub
Jun 27 '08 #1
7 6651
On Apr 23, 3:10 pm, Barkingmadscot <ba...@bcc-it.co.ukwrote:
I am try to find out how to check if the mouse button is held down.

The e.click =2 works, it allows me to enter the double click double.

I what the single click to do some different and then a click and
hold
to allow the drag and drop

I have looked at the mouseUp events be can not get it to work, when i
click and release my code does not enter mouseUP event?

See above for MouseDown Event

any ideas

Thanks

Barry

Private Sub tvNone_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles tvNone.MouseDown

Select Case e.Button.ToString

Case "Left"
If e.Clicks = 2 Then Exit Sub '# Exits to Double
click
event
If tvNone.SelectedNode Is Nothing Then Exit Sub '#
Exits if nothing is selected

'# Enable Treeview that node can be dropped into
Me.tvNone.AllowDrop = True
Me.tvRFQ.AllowDrop = True
Me.tvEnquiry.AllowDrop = False
Me.tvEval.AllowDrop = False
Me.tvRPT.AllowDrop = False
Me.tvPO.AllowDrop = False
Me.tvRAS.AllowDrop = False
Me.tvITD.AllowDrop = False
Me.tvRAD.AllowDrop = False

'# Get Selected node and node index
Dim DraggedNode As String = tvNone.SelectedNode.Text
Dim DraggedNodeIndex As Integer =
tvNone.SelectedNode.Index

'# Send info to DragDrag events
tvNone.DoDragDrop(Chr(40) & DraggedNode & Chr(41) &
Chr(40) & 0 & Chr(41), DragDropEffects.Move)
'# Remove Selected Node
tvNone.Nodes.RemoveAt(DraggedNodeIndex)

Case "Middle"

Case "Right"

End Select

End Sub
Hi,
I'm not sure if you're clear enough for detailing your problem, but in
your code "e.clicks" counts the number of times that a button is
pressed, so if you want to determine the left button of mouse is
pressed, then you'd better change it as:

If e.Button = Windows.Forms.MouseButtons.Left Then
' Code.......
End If

... instead of select-case.

HTH,

Onur
Jun 27 '08 #2
I am trying to find when the mouse left click is held down. I plan to
other stuff on the right clicks and possibly the middle clicks.

I plan to have different parts of my code doing different thing
depending on a double click, single click and click and hold (drag and
drop)

I have found when i select a node the mouseup event doesnt fire

if i select nothing both mousedown and mouseup events fire.

any thoughts

Jun 27 '08 #3
On 23 abr, 09:26, Barkingmadscot <ba...@bcc-it.co.ukwrote:
I am trying to find when the mouse left click is held down. I plan to
other stuff on the right clicks and possibly the middle clicks.

I plan to have different parts of my code doing different thing
depending on a double click, single click and click and hold (drag and
drop)

I have found when i select a node the mouseup event doesnt fire

if i select nothing both mousedown and mouseup events fire.

any thoughts
thought: select on mouseup?
the focus change probally is causing the lost of mouseup.
Jun 27 '08 #4
Hi,

I have only seen this done with a little global boolean, which is set to
MouseButtonDown = true in the MouseDown event and set to false in the
MouseUp event.

Cor

"Barkingmadscot" <ba***@bcc-it.co.ukschreef in bericht
news:3e**********************************@2g2000hs n.googlegroups.com...
>I am try to find out how to check if the mouse button is held down.

The e.click =2 works, it allows me to enter the double click double.
I what the single click to do some different and then a click and
hold
to allow the drag and drop
I have looked at the mouseUp events be can not get it to work, when i
click and release my code does not enter mouseUP event?
See above for MouseDown Event
any ideas
Thanks
Barry
Private Sub tvNone_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles tvNone.MouseDown
Select Case e.Button.ToString
Case "Left"
If e.Clicks = 2 Then Exit Sub '# Exits to Double
click
event
If tvNone.SelectedNode Is Nothing Then Exit Sub '#
Exits if nothing is selected
'# Enable Treeview that node can be dropped into
Me.tvNone.AllowDrop = True
Me.tvRFQ.AllowDrop = True
Me.tvEnquiry.AllowDrop = False
Me.tvEval.AllowDrop = False
Me.tvRPT.AllowDrop = False
Me.tvPO.AllowDrop = False
Me.tvRAS.AllowDrop = False
Me.tvITD.AllowDrop = False
Me.tvRAD.AllowDrop = False
'# Get Selected node and node index
Dim DraggedNode As String = tvNone.SelectedNode.Text
Dim DraggedNodeIndex As Integer =
tvNone.SelectedNode.Index
'# Send info to DragDrag events
tvNone.DoDragDrop(Chr(40) & DraggedNode & Chr(41) &
Chr(40) & 0 & Chr(41), DragDropEffects.Move)
'# Remove Selected Node
tvNone.Nodes.RemoveAt(DraggedNodeIndex)
Case "Middle"
Case "Right"
End Select
End Sub
Jun 27 '08 #5
I had thought about a boolean, but the mouseup event(s) dont fire when
i select something, as suggested the focus is lost and would know when
the change the boolean back.

again i would use the mouseup event(s) but i have the same porblem
when selecting a node the mouseup does not fire, thus any code in the
event would happen.

If anyone has any other ideas, let me know, also if i work it out i
will let you know.
Jun 27 '08 #6
Is there not anything like 'if mousebutton = true' (true being down
and false being up). i think the problem i have is focus changing
when i click, double click nodes etc.
Jun 27 '08 #7

"Barkingmadscot" <ba***@bcc-it.co.ukwrote in message
news:92**********************************@x35g2000 hsb.googlegroups.com...
Is there not anything like 'if mousebutton = true' (true being down
and false being up). i think the problem i have is focus changing
when i click, double click nodes etc.

Control.MouseButtons

LS

Jun 27 '08 #8

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

Similar topics

5
by: John Champaign | last post by:
Hi all, I'm working on an educational applet for a child with special needs. He's got a bit of a trick to make my life more difficult... To interact with the applet he needs to click on...
1
by: Jeroni Paul | last post by:
<BODY onmousemove="return false;" oncontextmenu="return false;"> <IMG src="button.gif" onmouseover="this.src='down.gif'" onmouseout="this.src='button.gif'"> </BODY> This simple example shows...
3
by: Csaba2000 | last post by:
I have set onmousedown to change the cursor, but this setting is ignored (IE 5.5; NN 6.1 on Win 2K Pro) until the mouse is either moved or the mouse button is released. On Opera 7.01, the setting...
1
by: Weston C | last post by:
I'm working on a small javascript application where I'd like to get one behavior when a user clicks on an image (image swap), but when they simply hold down the mouse button for a second, they get...
4
by: riscy | last post by:
I have a button with mouse_click event when pushed. However it does not generates mouse down event. To fix this I could poll the mouse state every 10mSec and see if the mouse button remains down...
3
by: Ryan Liu | last post by:
Can someone give a sample to prevent a row from being deleted in a datatable? I tried e.Row.RejectChanges(); in dt_RowDeleting() but seems does not work. I need verify if there other data...
10
by: sagar | last post by:
hi everyone, i m having a problem with mouse events. any help related is apreciated. i m having a form in which i m having 2 buttons. and i m moving(draging) these buttons on run time using...
6
by: marss | last post by:
Hi, How can I define in Firefox whether the left mouse button is pressed when I move mouse over a html element? The documentation says that "e.button == 0 for standard 'click', usually left...
5
by: Zaxxon21 | last post by:
I'm basically trying to implement a simple drop down menu list for a button that I have. When the user hovers over the button, I want a list of button options to appear below the button. If the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.