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
51
votes
5 answers

How to completely DISABLE any MOUSE CLICK

After the user clicks on...."log in" button, and other events, I made a loading script -to let users know they have to wait (Until ajax replies back). How can I DISABLE any MOUSE CLICKS (right click, left click, double click, middle click, x click),…
Omar
  • 11,783
  • 21
  • 84
  • 114
48
votes
2 answers

Vue JS : right click event directive

I know these vue event handlers: @click : mouse left-click @dblclick : mouse double click What could be the handler/directive to detect a right-click? Need to implement a custom Context menu in Vue Tree view.
Praveen Kamath
  • 959
  • 2
  • 10
  • 18
48
votes
4 answers

Pygame mouse clicking detection

I was wondering how to write code that would detect the mouse clicking on a sprite. For example: if #Function that checks for mouse clicked on Sprite: print ("You have opened a chest!")
user1406948
46
votes
3 answers

Global mouse event handler

I have the following code which I got from somewhere to capture mouse events. I modified it and made an event handler so that I can subscribe to it. The mouse events are captured correctly. But it never fires the event-handler. Can anybody figure…
Jehonathan Thomas
  • 2,110
  • 1
  • 28
  • 34
44
votes
10 answers

What is the most reliable way to hide / spoof the referrer in JavaScript?

Normally, the referrer is traceable through: JavaScript's document.referrer The request headers, e.g. PHP's $_SERVER['HTTP_REFERER'] I have set up a Codepad demo which shows these properties, for testing purposes. #Requirements: The original…
Rob W
  • 341,306
  • 83
  • 791
  • 678
40
votes
5 answers

How to get Mouse buttons 4 / 5 (Browser back / Browser forward) working in Firefox?

First, I need to say that I'm aware there is some confusion as to what button numbering scheme convention is used for these "Browser back" and "Browser forward" mouse buttons depending on whether you use numbering starting from zero 0 or one 1. …
TrinitronX
  • 4,959
  • 3
  • 39
  • 66
38
votes
9 answers

Differentiate between mouse and keyboard triggering onclick

I need to find a way to determine if a link has been activated via a mouse click or a keypress. Save The idea is that if they are using a mouse to hit the link then they can keep using the…
Craig
  • 8,093
  • 8
  • 42
  • 74
38
votes
2 answers

Is there any way to disable some DOM element from capturing mouse events?

I have an element which is on top of another element. I want to capture the mouseover event with the bottom element, but when the mouse cursor is over the top element the bottom element is not receiving the mouseover events. Is there any way to…
tester
  • 619
  • 1
  • 6
  • 5
35
votes
4 answers

How can I detect a rightmouse button event on mousedown?

I am updating/debugging and expanding the capabilities of my draggable script and I need to be able to achieve the following result: whatever.onRightMouseButtonMousedown = preventDefault(); I have done a lot of research to no avail, however, I know…
person0
  • 1,278
  • 2
  • 15
  • 20
35
votes
4 answers

How do I add a .click() event to an image?

I have a script that places an image based on a mouse click thanks to Jose Faeti. Now I need help adding a .click() event to the code below so that when a user clicks the image it performs the function shown in the script.
SS'
  • 819
  • 1
  • 8
  • 18
35
votes
5 answers

Detect left mouse button press

I hate this mess with the mouse buttons created by W3C an MS! I want to know if the left mouse button is pressed when I get a mousedown event. I use this code // Return true if evt carries left mouse button press function detectLeftButton(evt) { …
Boris Hamanov
  • 3,085
  • 9
  • 35
  • 58
34
votes
3 answers

Pass-through mouse events to parent control

Environment: .NET Framework 2.0, VS 2008. I am trying to create a subclass of certain .NET controls (label, panel) that will pass through certain mouse events (MouseDown, MouseMove, MouseUp) to its parent control (or alternatively to the top-level…
GentlemanCoder
  • 547
  • 1
  • 5
  • 11
34
votes
1 answer

WPF MouseDown event not firing everywhere in a control

I am currently fighting against another WPF struggle, namely mouse events. I basically have a very simple control (a Border containing a Grid which itself has a few TextBlocks). I am trying to achieve a simple behavior: Double click should turn the…
Damascus
  • 6,553
  • 5
  • 39
  • 53
34
votes
2 answers

Getting MouseMoveEvents in Qt

In my program, I'd like to have mouseMoveEvent(QMouseEvent* event) called whenever the mouse moves (even when it's over another window). Right now, in my mainwindow.cpp file, I have: void MainWindow::mouseMoveEvent(QMouseEvent* event) { qDebug()…
Switch
  • 5,126
  • 12
  • 34
  • 40
34
votes
4 answers

Using mousedown event on mobile without jQuery mobile?

I've built a webapp, and for a little bit of polish, I wanted to add mousedown and mouseup handlers to swap out images (in this case, to make a button look like it's being pressed). my code is something like this: window.onload = function() { …
Esaevian
  • 1,707
  • 5
  • 18
  • 30