mouseevent

Which key does the e.metaKey refer to in JavaScript MouseEvent?

偶尔善良 提交于 2020-01-01 04:20:13
问题 MouseEvent.metaKey doesn't seem to work. On both FireFox and Chrome, it returns false even if I hold the Win key while clicking: <!doctype html> <button onclick=alert(event.metaKey)>click while holding "meta key"</button> MDN states: The MouseEvent.metaKey read-only property returning a Boolean that indicates if the Meta key was pressed ( true ) or not ( false ) when the event occured. Note: On Macintosh keyboards, this is the command key ( ⌘ ). On Windows keyboards, this is the windows key (

Select & moving Qwidget in the screen

旧巷老猫 提交于 2019-12-31 18:04:06
问题 I'm using QTCreator and I created a QWidget, then I have hidden the title bar with setWindowFlags(Qt::CustomizeWindowHint); . But I can't select or move my widget. How can I use the mouseEvent to solve that? 回答1: If you want to be able to move your window around on your screen by just clicking and dragging (while maintaining the mouse button pressed), here's an easy way to do that: #include <QtGui> class W: public QWidget { Q_OBJECT public: explicit W(QWidget *parent=0) : QWidget(parent) { }

Select & moving Qwidget in the screen

。_饼干妹妹 提交于 2019-12-31 18:01:17
问题 I'm using QTCreator and I created a QWidget, then I have hidden the title bar with setWindowFlags(Qt::CustomizeWindowHint); . But I can't select or move my widget. How can I use the mouseEvent to solve that? 回答1: If you want to be able to move your window around on your screen by just clicking and dragging (while maintaining the mouse button pressed), here's an easy way to do that: #include <QtGui> class W: public QWidget { Q_OBJECT public: explicit W(QWidget *parent=0) : QWidget(parent) { }

How can I capture mouseevents and keyevents using python in background on linux

风格不统一 提交于 2019-12-31 10:48:11
问题 I'd like to make a python script that can run in the background but print text when a mouseevent or keyevent happens. Are there any libraries/builtin functionality to achieve this? Or any system commands I can call to get this info? Being root is no issue. 回答1: I guess, you might use python bindings for evdev: http://packages.python.org/evdev/index.html. In tutorial they give an example for keyboard, but it should be similar for mouse events: >>> from evdev import InputDevice, categorize,

Smooth vertical scrolling on mouse wheel in vanilla javascript?

安稳与你 提交于 2019-12-31 10:47:21
问题 I am a huge fan for vanilla javascript, currently I am working on a project where I need to implement smooth scrolling on mouse wheel scroll. I want to implement this using vanilla JS. I found a jQuery snippet on doing some research which go like below. $(window).on('mousewheel DOMMouseScroll', function(e) { var dir, amt = 100; e.preventDefault(); if(e.type === 'mousewheel') { dir = e.originalEvent.wheelDelta > 0 ? '-=' : '+='; } else { dir = e.originalEvent.detail < 0 ? '-=' : '+='; } $(

Convertion of mouse pointer coordinates into data coordinates and graphical object coordinates

我们两清 提交于 2019-12-31 05:36:10
问题 I googled all the day and, with my surprise, I have found only old (many years ago) answers about the topic. I tryed to mix individual pieces of code of the above mentioned answers to get a more complete solution to my needs, but nothing seems to work in the right way. The proposed solutions, even if logically understandable, don't work as expected. This should be the conceptual framework for coordinates implemented by Excel 1------------------------------------------+ |ChartObject | | 2-----

How to access ImageIcons in my mouseDragged event

六月ゝ 毕业季﹏ 提交于 2019-12-31 05:01:32
问题 I'm trying to figure out how to access my different images, drawn with paintComponent, (using JLabels is not allowed in the assignment) in my events. When dragging, I only want one image to move with my mouse drag and I cant seem to access "current image" with e.getSource(). My paintComponent will move all (3) images at the same time at the moment. My question is: how to get hold of a single ImageIcon with my mouseDragged? public class PhotoPanel extends JPanel implements MouseListener,

how to make tkinter <Enter> event work when <button-1> is pressed?

蹲街弑〆低调 提交于 2019-12-31 03:05:14
问题 I want to fill rectangles just like in paint. When mouse button is pressed I want every rectangle I enter to be filled and otherwise I want no event to take place. Here Is my code: from tkinter import Canvas import tkinter _width = 50 _height = 50 _size = 8 root = tkinter.Tk() root.title("draw me a lovely matrix") canv = Canvas(root, width=_width * _size, height=_height * _size) class Wrapper: btn1d = False def set_btn1d(value): print(value) Wrapper.btn1d = value def toggle_color(rect): print

Send Global keystroke using JavaScript in FireFox/Greasemonkey

不问归期 提交于 2019-12-31 01:51:07
问题 I currently have a GM script that captures a keystroke and programmatically clicks an element on a webpage. However, this only works when the page/tab has focus. Is there any way to capture the keystroke from the second page/tab and apply the click to an element on the first page/tab? I know I can get a reference to another window by opening it in JavaScript. However, I can't access elements in that window if it is on another domain. If I cannot do this using Greasemonkey, any suggestions on

Forward event to all components JAVA

浪子不回头ぞ 提交于 2019-12-30 11:49:39
问题 i dont how to solve this problem. I am developing a graphical editor, where arc(line) drawing is possible. I manually set the size of arc component to 1000x1000, so i dont have to change it when this arc will be dragged & dropped. Then i paint into this component the arc of the desired dimensions. Every arc components have mouse listener installed. The problem is, that only the most upper arc component get the mouse message. Also i have a mouse click listener installed on the JPane itself,