Questions tagged [mouseevent]

A general tag for user-interface events that are generated by the mouse. This includes pressing/releasing a button, clicking (including double/triple-clicks), moving, dragging, etc.

This tag deals with the events that are generated by preforming actions with a Computer Mouse and similar input devices which emulate the behaviour of a mouse (such as Touchpads and Graphic Tablets).

Mouse events are usually split into several categories:

  • Button Press (Button Down) event - The event where a previously unpressed mouse button just became pressed
  • Button Release (Button Release) event - The event where a previously pressed mouse button just became unpressed
  • Button Click event - A Button Press event followed by a Button Release event. In some platforms and locations, this concept has one or more of the following limitations:
    • The Press and Release both happend while the mouse was in the same place (the mouse wasn't moved between the press and the release). Sometimes there is a lighter version of this restriction, which only forces the mouse to be above the same "user interface element" on the press and release events.
    • The Press and Release both happend inside a limited (usually short) time interval.
  • Button Double (Triple/...) Click event - Two (Three/...) click events, one after another with the same mouse button. These may also have one or more of the limitations mentioned for a single click event
  • Button Move (Motion) event - An event where the mouse is moved. Usually this refers only to the case where none of the mouse buttons was pressed (for the case where one or more buttons was in fact pressed, see the next definition).
  • Button Drag event - An event where the mouse moves while one or more of the mouse buttons is held down
  • Button (Scroll) Wheel event - In modern mice, there is usually a wheel part called scroll-wheel, which can be moved (aka rolled, scrolled) up and down. Such a movement of that part is referred to as a Mouse Wheel event.
    • In some newer alternative input devices which also serve as a mouse, sometimes there won't be any physical whell. Instead, there may be hot-spot areas and/or buttons that will emulate the movement of the wheel. For example, in many touchpads, a movement in certain areas will be interpreted as scroll event.
    • Some mice (and other devices) allow scrolling not just up and down, but also in other directions (typically, left and right).

For more information and definitions, see the Computer Mouse and it's operation on Wikipedia.

6218 questions
33
votes
5 answers

How to display picture and get mouse click coordinate on it

I am wondering if it is possible in Python (Windows) to show some picture, then click with the mouse on this picture and get the coordinates of this click relative to picture edges. Thanks!
Alex
  • 2,009
  • 6
  • 24
  • 27
33
votes
9 answers

WPF/MVVM - how to handle double-click on TreeViewItems in the ViewModel?

(Note - this is a re-post as my first question got posted under wrong headline: Here Sorry!) I have a standard WPF treeview and have bound items to view model classes. I now wish to handle behaviour when items are double-clicked (opening documents…
Anders Juul
  • 2,407
  • 3
  • 34
  • 56
33
votes
3 answers

When to use touchmove vs mousemove?

I build a web mobile game, it runs on browsers (PC/Mobile). Do I need to use the touchmove or not? How can I run the touchmove event like the mousemove event?
Soliman
  • 1,132
  • 3
  • 12
  • 32
32
votes
5 answers

What is the best way to simulate a Click with MouseUp & MouseDown events or otherwise?

In WPF most controls have MouseUp and MouseDown events (and the mouse-button-specific variations) but not a simple Click event that can be used right away. If you want to have a click-like behaviour using those events you need to handle both which i…
H.B.
  • 166,899
  • 29
  • 327
  • 400
32
votes
6 answers

mousewheel event is not triggering in firefox browser

Please refer the below code. $(this.element).on("mousewheel", this.chartMouseWheel); chartMouseWheel:function(e) { if(e.originalEvent.wheelDelta /120 > 0) { alert('scrolling up !'); } else{ …
SivaRajini
  • 7,225
  • 21
  • 81
  • 128
31
votes
3 answers

Capture mouse clicks on WPF TextBox

I want to capture mouse clicks on a TextBox:
Robbert Dam
  • 4,027
  • 10
  • 39
  • 58
30
votes
4 answers

Capturing mouse events from every component

I have a problem with MouseEvents on my WinForm C# application. I want to get all mouse clicks on my application, but I don't want to put a listener in every child component neither use Windows mouse hook. On Flash I could put a listener on Stage to…
Gustavo Cardoso
  • 747
  • 2
  • 7
  • 20
30
votes
4 answers

How can a control handle a Mouse click outside of that control?

I'm writing a custom control and I'd like the control to switch from an editing state to it's normal state when a user clicks off of the control. I'm handling the LostFocus event and that helps when a user tabs away or if they click on to another…
chrislarson
  • 958
  • 2
  • 10
  • 20
30
votes
3 answers

JQuery mouseup outside window – possible?

I am trying to accomplish a rudimentary drag. On mousedown the item starts dragging, but not at the same speed as the mouse, so i continue dragging when the mouse is outside the window, but if the mouse is not over the page i can't get mouseup…
hooleyhoop
  • 9,128
  • 5
  • 37
  • 58
30
votes
5 answers

JavaScript simulate right click through code

I am writing some UI tests using Selenium and i have a JavaScript Tree control, using the Dojo toolkit. I have implemented a context menu for each node of the tree using the examples that Dojo provide, but I need the Selenium test to "invoke" the…
Mark
  • 14,820
  • 17
  • 99
  • 159
30
votes
1 answer

Handle mouse event anywhere with JavaFX

I have a JavaFX application, and I would like to add an event handler for a mouse click anywhere within the scene. The following approach works ok, but not exactly in the way I want to. Here is a sample to illustrate the problem: public void…
Sam De Meyer
  • 2,031
  • 1
  • 25
  • 32
30
votes
6 answers

How to measure the milliseconds between mousedown and mouseup?

Is there any way to measure the number of milliseconds between mouse press and release?
user166402
29
votes
4 answers

What are the proper typescript types for addEventListener mousemove and it's event argument?

Question: Without using any, What is the proper typing for my onMouseMove function? export class Main { private dTimer: number; constructor() { this.init(); } private init() { this.mouseHandlers(); } private mouseHandlers() { …
Armeen Moon
  • 18,061
  • 35
  • 120
  • 233
27
votes
1 answer

SendInput doesn't perform click mouse button unless I move cursor

SendInput doesn't perform click mouse button unless I move cursor. I would appreciate a help on this one, as I seems cannot wrap my head around it. I have a program that perform mouse click on foreground window, in which I am using SendInput to…
Dmitris
  • 3,408
  • 5
  • 35
  • 41
27
votes
1 answer

Vue.js - event handling with on-mouse-click down (and not up)

With Vue.js 2 when I add in an @click event to an element and attempt to click something, the event isn't triggered until after I have completed my click (press down -> up). How do I trigger an event immediate after a mouse click down? Example:
Ben
  • 1,550
  • 3
  • 15
  • 22