mas7004 Posted July 15, 2004 Posted July 15, 2004 How can I check to see if the mouse click was with a right click? If mouseClick = right click then Endif Thanks, Matt Quote
ost Posted July 15, 2004 Posted July 15, 2004 in your mousedown event try this: If e.Button = MouseButtons.Right Then msgbox("You pressed the right mouse button") end if Quote
mas7004 Posted July 15, 2004 Author Posted July 15, 2004 can i do it outside a mouseDown event, in a different event I have? Is there a another way to get whether the mouse button was clicked without using a parameter (such as 'e') from a method. Like something in: System.Windows.Forms....? Quote
mas7004 Posted July 15, 2004 Author Posted July 15, 2004 if have a 'chartDataClicked' from a 3rd party component. Thus I am not using the standard VB MouseDown event. Quote
Denaes Posted July 15, 2004 Posted July 15, 2004 if have a 'chartDataClicked' from a 3rd party component. Thus I am not using the standard VB MouseDown event. First, They're probobly extending the Mouse Down event into their own custom event. I'd think that something like this would still work. Second, if it doesn't work (they didn't pass through the mouse down arguments, making their own custom arguments or created their own mouse down event from scratch) with their component, in runtime, a mousedown is still happening. I'm not a pro, I don't know which is happening first, the Mouse Down or chartDataClicked, but my money is on MouseDown. Just use the MouseDown, do some logic to make sure it's over the chart and send the mousedown information into a delegate or variable where your other event can take advantage of that knowledge. Quote
ost Posted July 15, 2004 Posted July 15, 2004 if have a 'chartDataClicked' from a 3rd party component. Thus I am not using the standard VB MouseDown event. Even though you are using a 3rd party control you can just have a mouse down event for your form. In this event you can "catch" which button was used and then use that in your ChartDataClicked event. Quote
mas7004 Posted July 15, 2004 Author Posted July 15, 2004 Even though you are using a 3rd party control you can just have a mouse down event for your form. In this event you can "catch" which button was used and then use that in your ChartDataClicked event. do you mind providing a simple example? Quote
Denaes Posted July 15, 2004 Posted July 15, 2004 do you mind providing a simple example? Its really easy: If e.Button = MouseButtons.Right Then ClickFlag = True end if Just declare ClickFlag as a boolean in your form level declarations: dim ClickFlag as Boolean = False If MouseDown's e.Button = MouseButtons.Right, then it sets ClickFlag to true. In your event for chartClicked do a check for ClickFlag: If ClickFlag = True 'Reset the variable for future use ClickFlag = False 'Do other things you want to do when the chart is right clicked End If Of course after writing that, I think RightClickFlag or bRightClick might be a better name, but thats the gist of it. Quote
ost Posted July 15, 2004 Posted July 15, 2004 do you mind providing a simple example? Public rightMouseClicked As Boolean = False Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown If e.Button = MouseButtons.Right Then rightMouseClicked = True End If End Sub Private Sub DataGrid1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.Click If rightMouseClicked Then ' something rightMouseClicked = False End If End Sub the datagrid click has to be the datachartclick in your app Quote
Administrators PlausiblyDamp Posted July 15, 2004 Administrators Posted July 15, 2004 Does this 3rd party component not expose any events for responding to mouse actions? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.