mouseevent

How can I use the back and forward mouse buttons in a Swing application?

社会主义新天地 提交于 2019-12-01 01:15:47
问题 The question is pretty simple. I couldn't find many links regarding this issue, and the ones I found didn't seemed to avoid the real question. My application must handle the mouse pressed/released events for the back and forward mouse buttons. How can I handle this? EDIT: This is using JDK 1.6 . 回答1: Check if additional mouse buttons are detected by calling: MouseInfo.getNumberOfButtons(); Check if MouseEvents are fired when you click those additional buttons. If so, what does MouseInfo

Matplotlib - plot_surface : get the x,y,z values written in the bottom right corner

时间秒杀一切 提交于 2019-12-01 00:12:53
I am a quite new user of matplotlib. When plotting a surface (3D) with matplotlib and plot_surface, a window appears with the graph. In that windows, on the bottom right corner there is the coordinates of the actual position of the mouse. Is is possible to gain access to these values ? I have search on internet but very few solutions are proposed. For a 2D plot, these values are accessible using a tkinter.canvas but in 3D, when using the same technique the event.xdata and event.ydata did not return the good position for the mouse. Thank you in advance for your precious help, Antoine Thilo With

Pygame action when mouse 'click' on .rect?

假装没事ソ 提交于 2019-11-30 23:13:12
I have been writing a test function to learn how a mouse 'click' action on a pygame.rect will result in a reponse. So far: def test(): pygame.init() screen = pygame.display.set_mode((770,430)) pygame.mouse.set_visible(1) background = pygame.Surface(screen.get_size()) background = background.convert() background.fill((250,250,250)) screen.blit(background, (0,0)) pygame.display.flip() ## set-up screen in these lines above ## button = pygame.image.load('Pictures/cards/stand.png').convert_alpha() screen.blit(button,(300,200)) pygame.display.flip() ## does button need to be 'pygame.sprite.Sprite

Tracking mouse coordinates in Qt

坚强是说给别人听的谎言 提交于 2019-11-30 22:47:42
Let's say I have a widget in main window, and want to track mouse position ONLY on the widget: it means that left-low corner of widget must be local (0, 0). Q: How can I do this? p.s. NON of functions below do that. widget->mapFromGlobal(QCursor::pos()).x(); QCursor::pos()).x(); event->x(); I am afraid, you won't be happy with your requirement 'lower left must be (0,0). In Qt coordinate systems (0,0) is upper left. If you can accept that. The following code... setMouseTracking(true); // E.g. set in your constructor of your widget. // Implement in your widget void MainWindow::mouseMoveEvent

Scrolling the Window Under the Mouse

帅比萌擦擦* 提交于 2019-11-30 22:45:13
If you take a look at Visual Studio 2012, you'll notice that if you use the mouse wheel, the window under your mouse will scroll, and not the focused window. That is, if you have your cursor in the code editor, and move your mouse over the Solution Explorer window and scroll, the Solution Explorer will scroll, and not the code editor. The WM_MOUSEWHEEL message, though, only gets sent to the focused window, so in this case, the code editor. How can we implement our program such that the WM_MOUSEWHEEL messages scroll the window under the mouse, which is intuitive, and not the focused window?

Mouseleave triggered by click

大城市里の小女人 提交于 2019-11-30 21:51:33
问题 I have an absolutely-positioned div, and I'm trying to keep track of when the mouse moves over it, and when the mouse leaves. Unfortunately clicking on the text in the box occasionally triggers the mouseleave event. DEMO: js fiddle How can I prevent this? JS let tooltip = document.createElement('div'); tooltip.innerHTML = 'HELLO WORLD'; tooltip.setAttribute('class', 'tooltip'); tooltip.style.display = 'none'; tooltip.onclick = evt => { console.log('click') evt.stopPropagation(); } tooltip

Detect clicks on Object with Physics.Raycast and Physics2D.Raycast

瘦欲@ 提交于 2019-11-30 20:58:41
问题 I have an empty gameobject on my scene with a component box collider 2D. I attached a script to this game object with : void OnMouseDown() { Debug.Log("clic"); } But when i click on my gameobject, there is no effect. Do you have any ideas ? How can i detect the click on my box collider ? 回答1: Use ray cast. Check if left mouse button is pressed. If so, throw invisible ray from where the mouse click occurred to where to where the collision occurred. For 3D Object, use: 3D Model: void

How to Detect Forward and Back Mouse Button Events in Delphi?

China☆狼群 提交于 2019-11-30 20:15:24
If a mouse has other buttons in addition to the standard left/right/middle (e.g. forward/back), how can we detect those button clicks in Delphi? An example of how this is used is the Internet Explorer, where the forward/back button on the side of a Logitech or MS mouse cycles forward and back between any loaded web pages. This seems to replicate the Backspace/CTRL+Backspace on the keyboard but I tried to detect that using KeyPreview and the KeyPress event but it does not pick it up. Any idea how to detect clicks on these extended mouse buttons? Zoë Peterson You need to capture the WM

capture mouse position on setInterval() in Javascript

泄露秘密 提交于 2019-11-30 20:11:48
I have a function in javascript that moves one div depending on the mouse position. This function is set on a setInterval() function and executed every second. I need to capture the mouse position like this: function mousemov() { document.getElementById("myDiv").style.left = Event.clientX; //don't work } window.onload = function() { setInterval("mousemov()",1000); } Ps: I cannot use the mousemove event because the function must be executed even if the mouse is stopped. Thanks for helps! The only time that you can access the event object is during the execution of an event handler. So what you

Matplotlib - plot_surface : get the x,y,z values written in the bottom right corner

百般思念 提交于 2019-11-30 18:50:00
问题 I am a quite new user of matplotlib. When plotting a surface (3D) with matplotlib and plot_surface, a window appears with the graph. In that windows, on the bottom right corner there is the coordinates of the actual position of the mouse. Is is possible to gain access to these values ? I have search on internet but very few solutions are proposed. For a 2D plot, these values are accessible using a tkinter.canvas but in 3D, when using the same technique the event.xdata and event.ydata did not