mouseevent

Why my Mouse Event Handlers are not working when I have Touch Event Handlers?

你离开我真会死。 提交于 2019-12-02 03:32:54
问题 Some of my end users have touch screens, and others have PCs. On touch screens, PreviewMouseUp/Down fire along with the touch event handlers, causing duplicate behavior (functions written in PreviewMousUp/Down get executed twice). So my sample Button XAML: <Button x:Name="Whatever" Background="Transparent" MouseUp="Whatever_MouseUp" MouseDown="Whatever_MouseDown" TouchUp="Whatever_TouchUp" TouchDown="Whatever_TouchDown"> <StackPanel> <TextBlock x:Name="WhateverText" Text="Soemthing" FontSize=

Can QWidget detect mouse events on behalf of a QLineEdit?

白昼怎懂夜的黑 提交于 2019-12-02 02:26:00
问题 I have a QWidget that contains QLabels and QLineEdits side by side. When I click on a QLabel, I can use the mousePressEvent in QWidget. But when I click on QLineEdit, I can't detect the mousePressEvent in QWidget - only in the QLineEdit. I think that it is related to how QLineEdit works - I don't know the way to get mouse events within the whole region. EDIT : I have made a custom channel box for Maya like above. I try to select multiple channels by dragging the mouse. But as I mentioned, in

How to get control with lower zindex when mouse clicked in wpf?

江枫思渺然 提交于 2019-12-02 01:03:27
问题 I've several controls in the same canvas and may one be covered by another. They are all with same zIndex, but for the order loaded, some being up and others down. My Question if Acontrol is over Bcontrol, and I click on them, but only A gets the click event. How can I make B get the event, too? Thanks. 回答1: If you only wanted the one in the back to get the event, then for all the controls in front of the first one, you have to set IsHitTestVisible = False for the one behind to get the event

Qt 4.4: disabled widgets receiving mouse events

喜你入骨 提交于 2019-12-02 01:02:11
问题 As the title suggests, is there a way for a disabled widget to receive mouse events? I'm using QWidget::setEnabled() for changing the appearance of widgets but I still want to receive their mouse events. Thanks in advance :) 回答1: You can do this with an event filter on the widget in question. See QObject::eventFilter(). Your implementation might look something like this: bool MainWindow::eventFilter(QObject *obj, QEvent *event) { if (ui->pushButton) { if (event->type() == QEvent:

AS3 - Button inside MovieClip triggers MC's event

大憨熊 提交于 2019-12-02 00:22:58
On stage, I have a MovieClip named "mc" with a simple rectangle drawn inside. mc also has a Button child named "btn" which is another simple rectangle ( smaller than mc's rectangle obviously). Then I have this code on stage. function mcDown( _e:MouseEvent):void{ trace( "mc" ); } function btnClick( _e:MouseEvent):void{ trace( "btn" ); } mc.addEventListener( MouseEvent.MOUSE_DOWN, mcDown ); mc.btn.addEventListener( MouseEvent.CLICK, btnClick ); The problem I am having is when click the button, mcDown event is also triggered and traces both "mc" and "btn". How can I make it so that when I click

java console mouselistener

旧城冷巷雨未停 提交于 2019-12-02 00:17:25
I am trying to make a mouse recorder, I cant seem to get a mouse listener to work with a console, is this possable and how would I go about it Thanks. Unless you wrote your own console that fired mouse events, I dont' think you're going to be able to do it. What widget are you going to register your mouselistener against otherwise? The console isn't a swing component, therefore, no swing events. You can do this by using global hooks . In order to use them you'll need to include some natives or try the same using JNI (see: wikipedia ). Two examples: http://kra.lc/blog/2011/07/java-global-system

Qt 4.4: disabled widgets receiving mouse events

时间秒杀一切 提交于 2019-12-01 23:47:13
As the title suggests, is there a way for a disabled widget to receive mouse events? I'm using QWidget::setEnabled() for changing the appearance of widgets but I still want to receive their mouse events. Thanks in advance :) You can do this with an event filter on the widget in question. See QObject::eventFilter() . Your implementation might look something like this: bool MainWindow::eventFilter(QObject *obj, QEvent *event) { if (ui->pushButton) { if (event->type() == QEvent::MouseButtonRelease) { qDebug() << "mouse button"; return true; } else { return false; } } else { // pass the event on

Is there a better way to set an initial position for a JPanel graphic?)

被刻印的时光 ゝ 提交于 2019-12-01 23:37:25
In Chapter 15 of Liang's Intro to Java Programming (7th ed.) , he introduces a program to make a (2-D) ball on a JPanel and enlarge it upon clicking enlarge/shrink buttons. I've modified the program so that it also 1) enlarges/shrinks the ball if the user clicks/option+clicks, 2) allows you to pick the color of the ball by pressing a button, and 3) allows you to move the circle by dragging it with your mouse. The last modification is what was giving me trouble for a while, because I wanted to center the ball at the beginning, but then allow the user to move the ball around with the mouse. The

How to display clickable RGB image similar to pyqtgraph ImageView?

∥☆過路亽.° 提交于 2019-12-01 22:50:10
Despite not being a proficient GUI programmer, I figured out how to use the pyqtgraph module's ImageView function to display an image that I can pan/zoom and click on to get precise pixel coordinates. The complete code is given below. The only problem is that ImageView can apparently only display a single-channel (monochrome) image. My question: How do I do EXACTLY the same thing as this program (ignoring histogram, norm, and ROI features, which I don't really need), but with the option to display a true color image (e.g., the original JPEG photo)? import numpy as np from pyqtgraph.Qt import

MouseEvent on JPanel - wrong coordinate

我只是一个虾纸丫 提交于 2019-12-01 21:45:07
问题 I have written the following micro-paintbrush program in Java: import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.Graphics; import java.awt.GridLayout; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; class AuxClass1 extends JFrame