mouse

Moving mouse pointer on Android screen programmatically

情到浓时终转凉″ 提交于 2019-12-18 16:38:48
问题 I am developing an Android application where I would like to move the "mouse" pointer/cursor on an Android tablet. I know this is possible because when I connect a mouse (USB or BT) to an Android tablet (Honeycomb+), a cursor appears and I can interact with the tablet using the mouse only. I would like to control that mouse from Java on the Tablet. I already have a second device that can communicate the tablet and which can stream pointer coordinates to it. And no I can't use bluetooth. The

X11: How do I REALLY grab the mouse pointer?

廉价感情. 提交于 2019-12-18 13:12:03
问题 I've implemented a horizontal splitter widget in Xlib. I'm trying to grab the mouse when the user clicks & drags on the splitter bar (so that the user can dynamically move the split & thus resize the windows on either side of the splitter bar). I've used XGrabPointer() after receiving a left click, in hopes that all future mouse motion (dragging) will be diverted to the splitter window until the left button is released. Unfortuntately, it doesn't seem to work like that. If the user drags too

Performing a mouse click without moving cursor

假如想象 提交于 2019-12-18 12:42:43
问题 I couldn't find any solution except moving the cursor by Cursor class, clicking with mouse_event then moving the cursor to its old position. I am playing with SendInput function right now but still no chance for a good solution. Any advice? 回答1: You should use Win32 API. Use pInvoked SendMessage from user32.dll pInvoked Function Then read about mouse events: Mouse Input on msdn And then read about: System events and Mouse Mess....... Also there is lots of info: Info 回答2: Here's an example

Swapping left and right mouse button in .NET

南笙酒味 提交于 2019-12-18 12:39:05
问题 How do I swap left and right mouse buttons in .NET (preferably C#)? Basically the result should be the same as if the user checked the "Switch primary and secondary buttons" checkbox in the Mouse Properties through the control panel. I'm dealing with Windows XP, in case that makes a difference. 回答1: You can use a Windows API call to SwapMouseButton : using System.Runtime.InteropServices; // ... [DllImport("user32.dll")] public static extern Int32 SwapMouseButton(Int32 bSwap); // ... // Swap

How to programatically trigger a mouse left click in C#?

£可爱£侵袭症+ 提交于 2019-12-18 12:06:03
问题 How could I programmatically trigger a left-click event on the mouse? Thanks. edit: the event is not triggered directly on a button. I'm aiming for the Windows platform. 回答1: https://web.archive.org/web/20140214230712/http://www.pinvoke.net/default.aspx/user32.sendinput Use the Win32 API to send input. Update: Since I no longer work with Win32 API, I will not update this answer to be correct when the platform changes or websites become unavailable. Since this answer doesn't even conform to

Java : ignore single click on double click?

只愿长相守 提交于 2019-12-18 11:48:16
问题 can anyone think of a good way to ignore the single click that comes with a double-click in Java ? I'm looking to have different behaviors for each such that: single-click paints crosshairs on the click point double-click selects an object on the screen, but should not paint crosshairs on the click point ... can anyone think of a way to do this ? Some sort of timer set-up maybe ? An ideas appreciated :-) <disclaimer> ...and yes, I know I'm committing a most heinous usability / UI faux pas. <

Global Mouse Moved Events in Cocoa

半城伤御伤魂 提交于 2019-12-18 10:56:20
问题 Is there a way to register for global mouse moved events in Cocoa? I was able to register for the events using Carbon's InstallEventHandler() , but would prefer a Cocoa equivalent. I have looked for NSNotificationCenter events, but there doesn't seem to be any public event names (are there private ones?) Alternatively, is there a way to use NSTrackingArea for views with a clearColor background? The app is Snow Leopard only. 回答1: In SnowLeopard there is a new class method on NSEvent which does

Track mouse speed with JS

ぃ、小莉子 提交于 2019-12-18 10:43:30
问题 What's the best way to track the mouse speed with plain JS/JQuery? I'd like to track how fast a user moves the mouse in all directions (up/down/left/right). 回答1: Sparklines has a nifty example of tracking mouse movement and graphing it. Their code is available in the source of their site starting at line 315. Simple and effective. Here is the code: var mrefreshinterval = 500; // update display every 500ms var lastmousex=-1; var lastmousey=-1; var lastmousetime; var mousetravel = 0; $('html')

Track mouse speed with JS

一笑奈何 提交于 2019-12-18 10:43:16
问题 What's the best way to track the mouse speed with plain JS/JQuery? I'd like to track how fast a user moves the mouse in all directions (up/down/left/right). 回答1: Sparklines has a nifty example of tracking mouse movement and graphing it. Their code is available in the source of their site starting at line 315. Simple and effective. Here is the code: var mrefreshinterval = 500; // update display every 500ms var lastmousex=-1; var lastmousey=-1; var lastmousetime; var mousetravel = 0; $('html')

Handle all mouse events in Android

≡放荡痞女 提交于 2019-12-18 10:43:07
问题 Well, the question is rather simple - how can i handle left/right/middle click, wheel and (!)hover move in android 2/3/4. I've been digging on this topic and found the following in api 14 we can handle almost anything with fancy new MotionEvent we also have Open Accessory that seems to be ok with USB mouse since api 12 (still missing bluetooth) (UPD OA backported to 2.3.4) mouse actually works well on tablets with ICS and Honeycomb and cyanogen 2.3.7, but act like just single touch on every