mouseevent

Mouse event handling with cvSetMouseCallback

为君一笑 提交于 2019-12-01 05:01:04
I am writing a code for eye tracker using OS X / X Code / OpenCV 2.2. As part of the Eye Tracker training process, I am using cvSetMouseCallback to capture the data as per following: Right click for right eye; Left click for left eye. However, I found that the program could only work with left click (CV_EVENT_LBUTTONDOWN) while it does not work with right click (CV_EVENT_RBUTTONDOWN). At first, I thought it was a trackpad and mouse setting issues, however, it turns out that I have already set both Secondary Click as "Right" in the machine. Appreciate if someone could shed some light on this?

How can I make Robot press and hold a mouse button for a certain period of time?

夙愿已清 提交于 2019-12-01 04:13:01
问题 I am using Java to generate a mouse press using the Robot class: robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); However, I want the Robot to press the button for a certain period of time. How can I achieve this? 回答1: Just sleep a bit between the two actions (specified in milliseconds): Thread.sleep(long millis); robot.mousePress(InputEvent.BUTTON1_MASK); try { Thread.sleep(1000); } catch(Exception e) {} // Click one second robot.mouseRelease(InputEvent

Attempting to Simulate Mouse Click / Drag

你离开我真会死。 提交于 2019-12-01 03:48:31
问题 So I'm trying to simulate the left mouse click and the left mouse release to do some automated dragging and dropping. It's currently in a C# Winforms (Yes, winforms :|) and is being a bit of a goose. Basically, once a Click is sent, I want it to update the cursor position based upon the Kinect input. The Kinect side of things is fine but i'm not sure how to find if the button is still pressed or not. here's the code i'm currently using + some psuedocode to help better explain myself (the do

How to track mouse position from on page load as well as on mouse move?

你。 提交于 2019-12-01 03:24:59
I am tracking mouse movements using the following JavaScript: var mouseX = 0; var mouseY = 0; document.onmousemove = function (e) { mouseX = e.clientX; mouseY = e.clientY; } My problem is that if the mouse hasn't been moved since the page had been loaded, the mouseX and mouseY values both equal 0. How can I get the mouse values when the page is loaded as well as when the mouse is moved? The browser doesn't know where the mouse is until it moves. It's more complicated than just "get me the cursor position". What if there is no mouse (tablet) or what if the mouse is not over the browser window?

jquery menu hovering

南楼画角 提交于 2019-12-01 03:21:58
问题 i have a menu that when i mouse over a div it will show and on mouse out it will fade out. the problem is that if you roll over any of the menu's children the menu will disappear(because technically if you're over one of the children then you're not over the parent) is there a way so that rolling over the children will not count as a mouseout? here is my code: http://jsfiddle.net/32bLg/ 回答1: This is a very simple problem most people tend to massively overcomplicate with timers and special

Distinguish between mouse doubleclick and mouse click in wpf

▼魔方 西西 提交于 2019-12-01 03:14:31
In my WPF application , I am using ListView GridView, and I implemented a functionality that is associated to mouse double click. Is there a way, or a control that distinguish between the mouse double click and mouse click? I used a button, and implemented an event for mousedoubleclick, but the click event is still triggering Thanks for help It seems you just add the MouseDoubleClick= attribute. Check these links out: WPF Tutorial - Getting the DoubleClick Event MouseDoubleClick MSDN Documentation Detect mouse double click in WPF - Channel9 Sorry if I misunderstood your question. Handling the

Mouse event handling with cvSetMouseCallback

◇◆丶佛笑我妖孽 提交于 2019-12-01 03:13:30
问题 I am writing a code for eye tracker using OS X / X Code / OpenCV 2.2. As part of the Eye Tracker training process, I am using cvSetMouseCallback to capture the data as per following: Right click for right eye; Left click for left eye. However, I found that the program could only work with left click (CV_EVENT_LBUTTONDOWN) while it does not work with right click (CV_EVENT_RBUTTONDOWN). At first, I thought it was a trackpad and mouse setting issues, however, it turns out that I have already set

“Cannot convert string to ImageSource.” How can I do this?

六眼飞鱼酱① 提交于 2019-12-01 03:10:16
问题 private void HeroMouseEnter(object sender, MouseEventArgs e) { ((Image)sender).Source = GetGlowingImage(((Image)sender).Name); } public ImageSource GetGlowingImage(string name) { switch (name) { case "Andromeda": return "HeroGlowIcons/64px-Andromeda.gif"; default: return null; } } I'm just trying to make an event to change the image according to where the mouse entered. But I cannot make this work. Edit: I did this in Windows Forms and it work 100% like I want it to. How could I translate

Why does middle-click not trigger 'click' in several cases?

北城以北 提交于 2019-12-01 03:02:56
Here's a JSFiddle of the behavior I'm seeing, relating to middle-click and the click event in Chrome and FF. 'click' kinda sorta works Approach 1 : Bind a click handler directly to an a element and a middle-click will trigger the handler in Chrome but not in FF. $('div a').on('click', function(ev) { // middle click triggers this handler }); Approach 2 : Bind a delegated click handler to a div which contains one or more a . Middle click will not trigger this handler in Chrome or FF. $('div').on('click', 'a', function(ev) { // middle click doesn't trigger this handler }); This approach is

Safari iphone/ipad “mouse hover” on new link after prior one is replaced with javascript

老子叫甜甜 提交于 2019-12-01 02:48:27
问题 After you click a link on the iphone or ipad, it leaves a simulated mouse hover that triggers the a:hover css styling on that link. If the link has a javascript handler that keeps you on same page, the hover state will not change until you click on another link. This gets weird if you have an ajax widget that asks questions and each answer is link. When you touch one of the answers, it highlights with the hover state, and then when the question and answers are replaced (using javascript) by a