|
-
Mar 17th, 2010, 12:39 PM
#1
[RESOLVED] Ruling out right click
After a bit of research, I decided to ask a question to rule out an option that doesn't look viable. I have seldom used the right mouse button. Now I want to have a menu pop up whenever ANY control is right clicked, or even if the form (no control) is right clicked. This appears to be somewhere between tricky and impossible as 'default' right mouse button behavior. It looks like some controls, perhaps buttons as an example, don't generally deal with right mouse button clicks.
My usual boring signature: Nothing
 
-
Mar 17th, 2010, 12:51 PM
#2
New Member
Re: Ruling out right click
VB.net noob here but I have done this in other languages using hook proceedures such as "SetWindowsHookEx". Yet again VB noob here but it works in AutoIt to trap mouse events.
-
Mar 17th, 2010, 12:56 PM
#3
Re: Ruling out right click
Yeah, I'm looking at that route for a different reason. Might suit...might not.
My usual boring signature: Nothing
 
-
Mar 17th, 2010, 01:09 PM
#4
Hyperactive Member
Re: Ruling out right click
Here is something I researched and found. it doesn't seem intuitive as I don't know why they don't have a RightClicked event. Create a listbox(i.e. just serving as an example of a control you might use) on your form/whatever and call it lstResults. Here is some sample code:
vb Code:
Private Sub lstResults_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lstResults.MouseUp If e.Button = Windows.Forms.MouseButtons.Right Then MsgBox("You right clicked on the ListBox") End If End Sub
-
Mar 17th, 2010, 01:09 PM
#5
New Member
Re: Ruling out right click
-
Mar 17th, 2010, 02:13 PM
#6
Re: Ruling out right click
the button's mousedown + mouseup events have an e.button property as do all controls i think
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Mar 17th, 2010, 03:59 PM
#7
Re: Ruling out right click
Yes, I believe that to be the case. As long as I handle the mouse down or up event, I should be sort of ok.
But doggone it, the more I think about it, the less I think that is the right direction to go.
I'm going to close this off and ponder a bit more.
Thanks for the responses.
(I was about to add something else, but a thought occurred to me and I'm now off in a better direction).
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|