mouse

Java Keyboard/Mouse activity (even outside of my app)

隐身守侯 提交于 2020-01-11 05:23:07
问题 I need to detect when the mouse or keyboard activity is present. My application runs in the background (tray) and I need to detect this activity even when my app isn't in focus. I don't need to know what keys were pressed, but simply WHEN they are pressed. Can I do this with just Java? I have read some solutions using JNI and C++/C but they seem to be OS specific. Is there an easy solution to this that will work with Windows, Linux, and Mac? Thanks! 回答1: Since JNI is required, which relys on

Get Mouse Position on Canvas (But NOT on window)?

爱⌒轻易说出口 提交于 2020-01-09 07:21:53
问题 I have a project in WPF 4 and vb.net 2010. I have a canvas inside a window. The window is full screen, but the canvas is set to a solid 640x480 in the center of the window. I need to get the mouse position inside of the canvas, but NOT inside of the window. How do I do this? 回答1: Doesn't this work? Point p = Mouse.GetPosition(canvas); The position of the mouse pointer is calculated relative to the specified element with the upper-left corner of element being the point of origin, 回答2: Hi the

Use Pygame mouse while hidden

五迷三道 提交于 2020-01-07 02:29:08
问题 Is there a way to use the mouse while, pygame.mouse.set_visible(False) is activated. Currently mouse only returns the bottom-right coordinate when tried to be used. Being able to get correct coordinates while mouse is hidden is required. Could not find an answer at their documentation. 回答1: I solved the problem by using an invisible cursor. pygame.mouse.set_cursor((8,8),(0,0),(0,0,0,0,0,0,0,0),(0,0,0,0,0,0,0,0)) 来源: https://stackoverflow.com/questions/40627934/use-pygame-mouse-while-hidden

The count number of pressed button

你说的曾经没有我的故事 提交于 2020-01-06 03:51:05
问题 I need that when I press the button to show me how many times was the button pressed. I use this method, but on console still show me the number 1. Here is code: button_help.setOnMousePressed(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { int count = 0; count ++; System.out.println(count); } }); 回答1: Your solution doesn´t work as you are reseting the value of variable every time you click button. You have to define it once and than just increase the valu of

How to fire MouseEnter for one object if another object has mousecapture?

情到浓时终转凉″ 提交于 2020-01-04 16:58:36
问题 I have a strange question and a vb.net 2010 and wpf4 project. I have a label that, when clicked, captures the mouse (MyLabel.captureMouse) and follows it around the screen until the mouse clicks again, at which point the object and the mousecapture is released. However, I still need the functionality of mouseenter for another object. How do I get these two things to work together? EDIT: There are two solutions to this, it seems, one of which I discovered. However, since Rick's should work as

How to fire MouseEnter for one object if another object has mousecapture?

大憨熊 提交于 2020-01-04 16:58:33
问题 I have a strange question and a vb.net 2010 and wpf4 project. I have a label that, when clicked, captures the mouse (MyLabel.captureMouse) and follows it around the screen until the mouse clicks again, at which point the object and the mousecapture is released. However, I still need the functionality of mouseenter for another object. How do I get these two things to work together? EDIT: There are two solutions to this, it seems, one of which I discovered. However, since Rick's should work as

How to fire MouseEnter for one object if another object has mousecapture?

扶醉桌前 提交于 2020-01-04 16:58:11
问题 I have a strange question and a vb.net 2010 and wpf4 project. I have a label that, when clicked, captures the mouse (MyLabel.captureMouse) and follows it around the screen until the mouse clicks again, at which point the object and the mousecapture is released. However, I still need the functionality of mouseenter for another object. How do I get these two things to work together? EDIT: There are two solutions to this, it seems, one of which I discovered. However, since Rick's should work as

How to draw on an unfilled box on a video stream using the mouse

纵然是瞬间 提交于 2020-01-04 09:10:24
问题 I am using dshownet(first time) and C#. I have got a sample to take the web cam input and display it on a form. I now need to draw a rectangle on top of the video stream using the mouse. (the intent is to track what is inside the box from there onwards). I heard that there is something called VMR. So I went to the dshownet samples and went through them. I didnt find any samples that use the mouse to overlay a shape on the video stream. Someone on here suggested to use colorkey. Another person

mouse click events in an NSView subclass

亡梦爱人 提交于 2020-01-04 05:38:08
问题 I have an NSView subclass that gets initialized with an OpenGL context and has a bunch of mouse event handling (onMouseDown, etc...). I have an app using it which has a main Cocoa window that contains the view and all the mouse events are working properly. However, I'm trying to use it now in another app where i have a secondary window that pops open and gets initialized with the view and while i get mouse moved evets, I don't seem to get any mouse click (or keyboard for that matter) events

WM_MOUSELEAVE not being generated when left mouse button is held

為{幸葍}努か 提交于 2020-01-03 17:23:08
问题 In my Win32 app, I don't get WM_MOUSELEAVE messages when I hold down the left mouse button and quickly move the mouse pointer out of the window. But If I, holding down the left mouse button, start from the inside of the window and move slowly past the window edge, it'll generate a WM_MOUSELEAVE. If I don't hold the left mouse button, I get WM_MOUSELEAVE messages every time no matter how fast the mouse pointer moves off the window. What's the difference? What can I do to handle both cases