mouse

Vimeo iFrame Stealing Mouse Wheel Event on Firefox

依然范特西╮ 提交于 2019-12-08 19:21:32
问题 I made this example here: http://jsbin.com/pokahec/edit?html,output // creates a global "addWheelListener" method // example: addWheelListener( elem, function( e ) { console.log( e.deltaY ); e.preventDefault(); } ); (function(window,document) { var prefix = "", _addEventListener, onwheel, support; // detect event model if ( window.addEventListener ) { _addEventListener = "addEventListener"; } else { _addEventListener = "attachEvent"; prefix = "on"; } // detect available wheel event support =

JFreeChart : obtain data source value on mouse click

ぃ、小莉子 提交于 2019-12-08 17:36:29
问题 I have a JFreeChart instance that displays process memory status, initialized as follows: m_data = new TimeSeriesCollection(); TimeSeries vmsize = new TimeSeries("VMSize"); TimeSeries resident = new TimeSeries("Resisdent"); TimeSeries shared = new TimeSeries("Shared memory"); TimeSeries code = new TimeSeries("Code"); TimeSeries data = new TimeSeries("Data"); m_data.addSeries(vmsize); m_data.addSeries(resident); m_data.addSeries(shared); m_data.addSeries(code); m_data.addSeries(data);

Mouse position on mouseover event

牧云@^-^@ 提交于 2019-12-08 16:45:42
问题 Is it possible to get the exactly mouse position in a mouseouver event of a image? If i use a function that update the mouse position on document mouse move event I can have problems with delay and this kind of thing and wouldn't get the EXACTLY position 回答1: If you are looking for a simple JS to get the cursor position for a MouseOver event, here is the sample code: <!DOCTYPE html> <html> <head> <script> function getPos(e){ x=e.clientX; y=e.clientY; cursor="Your Mouse Position Is : " + x + "

PyGame: draw.rect() has invalid parameters

时光怂恿深爱的人放手 提交于 2019-12-08 13:55:47
问题 I'm trying to learn mouse events with PyGame, and I'm trying to draw a box wherever the user clicks. I'm setting a variable equal to pygame.mouse.get_pos(), and calling individual tuple members according to the mouse's x, y position. Here's the code: import pygame, sys pygame.init() screen = pygame.display.set_mode((800, 600)) mousepos = pygame.mouse.get_pos() while True: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() if event.type == pygame.MOUSEBUTTONDOWN: pygame

NSEvent and Magic Mouse

a 夏天 提交于 2019-12-08 13:49:34
How do I distinguish whether the event -(void)scrollWheel:(NSEvent *)event was triggered by a Magic Mouse or a trackpad? The reason I'm asking this question is because I want to assign a different action to the scrolling event when a trackpad is used because the user can pinch to zoom on the trackpad. On the magic mouse, however, the user can't pinch easily, so I want to use the scrolling function as a substitute for pinching. I can distinguish between a normal mouse and a Magic Mouse using this line: if (([event momentumPhase] != NSEventPhaseNone) || [event phase] != NSEventPhaseNone) However

Hide and show mouse cursor after a particular interval of time

╄→гoц情女王★ 提交于 2019-12-08 12:54:57
问题 I want to hide my mouse after 5 seconds if my system mouse is not moved. I asked in this question check mouse activity Now I'm able to check the activity of mouse and change cursor ... My code is: #define WINDOWS_LEAN_AND_MEAN #include <windows.h> #include <io.h> #include <iostream> #include <ctime> #include "resource.h" HCURSOR hCurBlank; HCURSOR hCurstandard; void blank_cursor() { hCurBlank = LoadCursor(NULL, MAKEINTRESOURCE(IDC_CURSOR1)); //loading a cursor from a file HCURSOR

Python Tkinter - canvas scrolling with mouse position

北城余情 提交于 2019-12-08 12:24:38
问题 I think this is a very common question, but I couldn't find the answer. I'm trying to make a window that scrolls depending on the mouse position: if the mouse is close to top of the screen, it scrolls to the top, if it is close to the right border, it scrolls to the right and so on. Here is the code: from tkinter import * from tkinter import ttk root = Tk() h = ttk.Scrollbar(root, orient = HORIZONTAL) v = ttk.Scrollbar(root, orient = VERTICAL) canvas = Canvas(root, scrollregion = (0, 0, 2000,

Detecting if a mouse is wireless

孤者浪人 提交于 2019-12-08 11:33:33
问题 I am trying to detect whether a wireless mouse is present on a computer. I would like my program to run in the background. I would prefer to do this in Java however if this goes beyond Java's capabilities I can use another language. Can someone please get me started? (This seems like a Google-able question but I cannot find anything) 回答1: This is beyond Java and is highly OS-specific. You have to query the appropriate device drivers for the operating system; for example, on Linux this would

Set Statusbar Text on Mouse Hover - Works for controls but not MenuItems

亡梦爱人 提交于 2019-12-08 10:45:06
问题 I devised the following code for displaying a control's Tag property on mouseover. The code works fine for standard controls such as Labels and TextBoxes but I cannot get it to work for my MenuItems (more specifically ToolStripMenuItems). Could y'all please take a look at my code and tell me what I did wrong? Thanks in advance! public void Form1_Load(object sender, EventArgs e) { ... this.addEventsToAllComponents(this); } private void addEventsToAllComponents(Component component) { if

Javascript (jQuery) limit mouse movement speed inside an element

坚强是说给别人听的谎言 提交于 2019-12-08 09:45:40
问题 The task is to draw a curve ob canvas. The problem is that if mouse is moved too fast, the coordinates are skipped and not captured. (Html5/Js canvas capturing mouse coords when it moves fast - my previous post..) Is there a cross-browser way to limit mouse speed inside an element (div, canvas, etc.)? 回答1: I assume by "limiting mouse speed" you actually mean enable capturing high volume of mouse events so that you get more detailed information, or resolution, of the mouse path. The browser