If you are trying to catch a right mouse click event on a control in order to select a cell in a grid or show a pop-up menu:
Which of the MouseDown or MouseUp events be used if these are the only two to choose from?
Will this work for you?
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then
PopupMenu test
End If
End Sub
I had the same question in my mind. I came to this just by right clicking on Firefox screen, my desktop screen, and my Visual Studio IDE screen. If you keep right mouse button down and not release it, the menu won't show up in these programs. This means they placed the code in MouseUp event. So as a rule of thumb we'd better place it in MouseUp but my reason is not very conclusive.
Related
I have an NSView subclass in which I need to detect left and right mouse down events. mouseDown: is working just fine, but rightMouseDown: doesn't fire until the mouse button has been released, at which point both the down and up methods are called in succession. How can I make the right mouse down event trigger its corresponding method immediately?
The problem was that I have a NSPanGestureRecognizer added to the NSView with its buttonMask set to 0x2 (right mouse button). If I remove or disable this gesture recogniser, it allows rightMouseDown: to be called when the right button is pressed down. I'm still trying to figure out why, but at least now I have a starting point.
I want to make a program (program 1) that will click a toolbar button on another program (program 2). I have the handle of the window the toolbar button is in and I have its button ID. At first I thought I could use the function:
SendMessage (buttonHandle, BN_CLICK, 0, 0);
but I have no clue as to how to get the handle of the tool bar button. I tried to use the function:
GetDlgItem ( windowHandle, buttonID);
but it doesn't work. I also have been told that since it's a toolbar button, there is no specific handle for it... kind of odd, not sure how that works...
Question 1:: is there a handle for toolbar buttons and how may I get it?
Question 2 (MAIN AND MOST IMPORTANT QUESTION!):: what function can I use to click on a toolbar button? (please mention the parameters for the function too)
Is there a handle for toolbar buttons and how may I get it?
No. Toolbar buttons are non-windowed. They do not have window handles.
What function can I use to click on a toolbar button?
You use UI Automation to automate other applications.
How to detect a mouse click (or mousedown) event on a simple dropdown combo (combobox with style=1)?
I am unable to see mouseclick or mousedown event handlers for combobox in my vb6 IDE.
My aim is to detect right click.
Thanks in advance.
If the events aren't exposed, you may need to subclass the control and handle the WM_RBUTTONDOWN message.
When you push down the left mouse button mouse down event fires. If you then move the mouse over a label (while holding the mouse button down) mouse over event does not fire.
Is there any way to enable this events or fire them manualy or simulate them?
What you are actually doing is two separate events, one is a mouse down event as you have described and the other is a mouse drag.
If you want to simulate them, that you might have to consider using a mouse click to track the user's (x,y) location. Subsequently, if you want to "simulate" it you could do some computation and decide for yourself if it is indeed a mouse click or mouse drag event that has occurred.
Hope it helps :) Cheers!
If you tap on the left hand side of the screen in Outlook then an event is triggered (in this case a checkbox appears).
I would like to know the xaml on how this is achieved. It cannot be a simple "MouseLeftButtonUp" event because if you drag your finger more than a few pixels then the event does not trigger.
In my own app I am trying to get an icon appear within a listbox that has a SelectionChanged event. The issue is that if you do not touch the small icon precisely then you are triggering the listbox event rather than the event I want to occur when pressing the image.
I think I need to wrap my image in a Canvas but then am still stuck as to what the event should be.
How do you increase the target size of the area where a user can click on your element?
What event should an image have when within a listbox (which is within a pivot) that has a SelectionChanged event? (MouseLeftButtonUp causes issues if you half drag to the next pivot and lift your finger - it triggers the MouseLeftButtonUp event)
I implemented something very similar to that behavior by making an itemtemplate where the checkbox was pushed offscreen to the left by using a negative margin.
I then created 2 visual states, one for Open and Closed. The open state set the margin to 0, bringing the checkbox back onscreen. Closed state had the negative margin.
With the fluidmove behavior, switching between states on button press was EASY. The only thing you'd have to add would be an invisible button/touch area on the left that would also trigger "opening" the checkbox column (changing state to reset the margins).
Hope that helps...
The outlook app is a native app, so it probably isn't using xaml at all.
If you're worried about the mouse events, then you should look at the gesture stuff in the silverlight toolkit, it contains tap, etc events that make a little more sense on the phone.
Increasing the target size and generally making stuff touchable: wrap it in a Button, then alter the ControlTemplate for the Button to remove the border.
If you look at the ControlTemplate for a Button, (Expression Blend, Edit Template, Edit a copy) you'll see the mechanics of the touch area. It's nothing more than padding/margin.
Thus, you can't bleed your touch region out without altering the layout and affecting other items around the control. I'd do two things:
First, I'd think about whether my whole control should be larger in the first place with good spacing around it. Is my design right?
Second, I'd cheat. I'd float a fixed sized button with no border over the area using the Translate transformation to move it around freely.
Good luck,
Luke