mouseevent

pointer motion. why are numbers so high? why does it print info in blocks not a constant stream?

馋奶兔 提交于 2019-12-02 06:11:45
Hi! I am trying to write a program where I need to report the position of every mouse motion. I have called the XSelectInput() function with a PointerMotionMask mask. Everything seems to work alright but the numbers after printing don't appear after every movement, they appear in blocks and also the numbers in event.xmotion.x and event.xmotion.y are very high, in the hundred thousands. What is causing these large numbers? Also is my program getting every number and reporting it immediately or is it being stored in a queue and sent in blocks to the terminal? Thanks Here's my event loop: while(1

How to draw a rectangle on canvas like we do on paint?

时光总嘲笑我的痴心妄想 提交于 2019-12-02 05:48:20
Say i want to draw a rectangle on canvas. I want to be able to get the co-ordinates from user's mouse. Ideal scenario is user clicks at a point and drags down to another end like those rectangles we draw using paint. How can i draw a rectangle like we do in paint by dragging mouse? (how to get the co-ordinates of the mouse when he clicks mouse and leaves at?) Here's a outline of how to drag-draw a rectangle on canvas: In mousedown: save the starting mouse position set a flag indicating the drag has begun In mousemove: clear the canvas of the previous rectangle calculate the rectangle width

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

不问归期 提交于 2019-12-02 05:10:53
问题 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

Java Read Raw Mouse Input

你离开我真会死。 提交于 2019-12-02 05:01:12
I'm looking for a way in Java to read in raw mouse input and not just the event listeners. I'll tell you what I'm doing. Essentially, there is a game where if you move the mouse to the right, I want Java to send key signals of the 'd' key being pushed down, and when the mouse is moved to the left, the 'a' key being held down. But, when you move the mouse, the game quickly corrects the mouse position and sends it right back into the middle of the screen. So, if you use mouse listener, you get one event of the mouse being moved to the right, then another quickly following of the mouse being move

mouseenter mouseleave and a select

試著忘記壹切 提交于 2019-12-02 05:00:54
问题 http://jsfiddle.net/msNhr/ When you go over "aaaaa" an overlay is display, when you try to select something from the select within the overlay closes. How do I get this right? The overlay should only close if the actual overlay area is left. Thanks! 回答1: see this fiddle: http://jsfiddle.net/msNhr/3/ (tried on Fx14 and Ch 21.0.1180.57) I've just stopped the propagation of mouseleave event so it won't reach the overlay relevant js $(function() { $('#a').mouseenter(function() { $('#overlay')

java: TrayIcon right click disabled on Mac OsX

女生的网名这么多〃 提交于 2019-12-02 04:34:10
I'm trying to develop a Mac OsX app provided by a system tray icon, so after the first attempt with the simplest code to achieve it I noticed that every apps tray icon's (both system and user apps) on mac osX (10.8) allows to activate the relative popup menu with both left and right click on it but with my project only the left (MouseEvent.BOTTON1) button causes the popup menu to pulldown. Here's my code: public class SystemTrayDemo { private SystemTray tray; private TrayIcon tray_icon; public SystemTrayDemo() { if (!SystemTray.isSupported()) { JOptionPane.showMessageDialog(null, "System tray

Change button content in WPF

给你一囗甜甜゛ 提交于 2019-12-02 04:32:38
I have: private void button1_MouseEnter(object sender, EventArgs e) { for (int i = 0; i > 2; i++) { button1.Content = Convert.ToString(i); System.Threading.Thread.Sleep(1000); } tekst.Text = "Mouse Enter"; } When I enter on Button I see only Mouse Enter , but Content on Button don't change. Why? What I can do wrong? Your for loop never execute because you have wrong condition, change it to following code: for (int i = 0; i < 2; i++) Also you should use BackgroundWorker ( msdn ) to update your GUI dynamicly. private void button1_MouseEnter(object sender, MouseEventArgs e) { BackgroundWorker

KineticJS - update text layer with new mouse position

为君一笑 提交于 2019-12-02 04:31:20
I am using the following to get the mouse position: var coordinate = 0; ............ canvas1.addEventListener('mousemove', function (evt) { var mousePos = getMousePos(canvas1, evt); var nY = Math.round(mousePos.y); var nX = Math.round(mousePos.x); coordinate = "x=" + nX + ", y=" + nY; $('#pValue').val(coordinate); }, false); It works great if I display the value in a text field; however I could not update a text layer: dlayerA1Text = new Kinetic.Layer(); var simpleTextRight = new Kinetic.Text({ x: lOffset + (lOffset * 0.25), y: 15, text: coordinate, fontSize: 12, fontFamily: 'Calibri', fill:

AS3 - Button inside MovieClip triggers MC's event

时光总嘲笑我的痴心妄想 提交于 2019-12-02 04:15:49
问题 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,

Can QWidget detect mouse events on behalf of a QLineEdit?

倾然丶 夕夏残阳落幕 提交于 2019-12-02 03:34:49
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 the QLineEdit regions I can't do this. class channelWidget(QtGui.QWidget): def __init__(self, parent