mouseevent

How can I make a window invisible to mouse events in WPF?

試著忘記壹切 提交于 2019-12-05 10:56:48
I created this class, and it works perfectly for make my WPF application transparent to mouse events. using System.Runtime.InteropServices; class Win32 { public const int WS_EX_TRANSPARENT = 0x00000020; public const int GWL_EXSTYLE = (-20); [DllImport("user32.dll")] public static extern int GetWindowLong(IntPtr hwnd, int index); [DllImport("user32.dll")] public static extern int SetWindowLong(IntPtr hwnd, int index, int newStyle); public static void makeTransparent(IntPtr hwnd) { // Change the extended window style to include WS_EX_TRANSPARENT int extendedStyle = GetWindowLong(hwnd, GWL

Workaround for setToolTipText consuming mouse events?

丶灬走出姿态 提交于 2019-12-05 10:38:08
This seems to be a verified problem with SWING http://forums.sun.com/thread.jspa?threadID=385730 I'm currently trying to set the tooltip text of a tab in a JTabbedPane but when I do I can't actually select the tab anymore because the tooltip added a mouse listener that is consuming the events. Does anyone know of a workaround that allows me to keep my tooltips AND my mouseevents? Thank you. As per request here is my SSCCE package jtabbedbug; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTabbedPane; public class JTabBug{ public static void main(String[] args) {

Qt5 C++ automated mouse clicking

僤鯓⒐⒋嵵緔 提交于 2019-12-05 10:30:56
I am trying to make an application where the mouse goes to certain locations on screen and automatically clicks left button. The problem is I cant click outside the Qt application so I made a workaround by making the application transparent to mouse clicks and making it full screen using this code: int x = 800; int y = 500; this->setWindowFlags(Qt::WindowStaysOnTopHint|Qt::FramelessWindowHint|Qt::ToolTip); this->setAttribute(Qt::WA_TranslucentBackground); this->setAttribute( Qt::WA_TransparentForMouseEvents); QCursor::setPos(x,y); qDebug()<<QCursor::pos(); QWidget *d = QApplication::desktop()-

How can I constrain locators to a limited (but not regular) set of positions?

泄露秘密 提交于 2019-12-05 09:58:22
In Mathematica, locators can be constrained to certain screen regions via the parameters of LocatorPane (See LocatorPane documentation.) A list of three ordered pairs {{{minX, minY}, {maxX, maxY}, {dX, dY}}} is usually the key to determining the behavior of locators. {minX, minY} and {maxX, maxY} set the region. {dX, dY} sets the jump size: zero for unrestrained, any other positive number for the size of each hop. In the code below, {{{-.9, 0}, {1, 0}, {0, 0}}} sets the region and jumps for the locator pts . The first two ordered pairs limit the locators to the interval [-9, 1] on the number

Set mouse position not working c#

我怕爱的太早我们不能终老 提交于 2019-12-05 09:57:59
I've been trying to write a small utility that will modify the boundaries of where my mouse can go on the whole screen. I've used the the global mouse hook library that I found here (I'm using version 1), and then pass the mouse position information from the event it generates to my own function (just a test to see it working for now). internal void ProcessMouseEvent(System.Drawing.Point point) { Cursor.Position = new Point(50,50); } When running it, the mouse does appear to flash to the specified point, but will instantly revert back to where it was before the change if it was a movement

How to detect if mouse is moving when mouseup is fired?

你。 提交于 2019-12-05 09:39:23
I've tried to implement a page panorate by dragging. In my implementation the page moves for a while after user has released the mouse button, like dragging maps in Google Maps. Now I'd like to prevent this effect, when the mouse is no longer moving when user releases the button. The problem is, that I just can't figure out how to detect if the mouse really moves when mouseup event is fired. For now I've tried to tackle this problem by calculating the dragging speed and then compare the speed to a pre-valued "sensitivity", which works most of the time, but sometimes it fails. Simplified

jQuery is mousedown on mouseover

偶尔善良 提交于 2019-12-05 08:26:17
I have a table where i want to change cell background on mouse over and mouse button down, my current solution doesn't work as I want it to : function ChangeColor(sender) { sender.style.backgroundColor = 'yellow'; } var clicking = false; $(document).mouseup(function() { clicking = false; }); $(document).ready(function() { $('#Table1 tr').each(function() { $('td', this).each(function() { $(this).mousedown(function() { clicking = true; }); $(this).mousedown(function(event) { if (clicking==true) { ChangeColor(this); } }); }); }); }); Is there any way to make it work like that ? EDIT: Given your

Dispatch MouseEvent

99封情书 提交于 2019-12-05 08:21:23
Is there a way to dispatch MouseEvent , same as dispatchKeyEvent using the KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(listener); that happens before the event transferred to the component ? I know I have 2 options 1) add mouse event to all compoenents recursive 2) use a transparent glasspane Does Java support this , or do I have to use the one of the options above? thank you Have you tried java.awt.Component.dispatchEvent(AWTEvent) ? import java.awt.*; import java.awt.event.*; import javax.swing.*; JButton jb = new JButton("Press!"); MouseEvent me = new

Mimicking/faking a Mouse Click and Mouse Wheel using Qt

≡放荡痞女 提交于 2019-12-05 06:26:57
How to mimic/fake a Mouse Click and Mouse Wheel using Qt? To be more specific, I want to click inside and outside the Qt application. Thanks in advance! HostileFork If you want to simulate clicks on widgets inside your application, check out QTestEventList : A QTestEventList can be populated with GUI events that can be stored as test data for later usage, or be replayed on any QWidget. It lets you perform keypresses and various mouse events, but no wheel. Regardless, the source code should give cues on best practices for this sort of operation: http://qt.gitorious.org/qt/qt/blobs/master/src

Double click to Windows form in C#

☆樱花仙子☆ 提交于 2019-12-05 06:26:18
问题 How can I detect, which mouse button have double clicked the form i.e. Left, Right or Middle? Updated: I am using .NET2.0 回答1: Store the last clicked button in MouseUp event and then check that in the double click event. Sample code: MouseButtons _lastButtonUp = MouseButtons.None; private void Form1_MouseUp(object sender, MouseEventArgs e) { _lastButtonUp = e.Button; } private void Form1_DoubleClick(object sender, EventArgs e) { switch (_lastButtonUp) { case System.Windows.Forms.MouseButtons