mouseevent

Making sure my XNA game has focus before handling mouse and keyboard events

穿精又带淫゛_ 提交于 2019-12-08 15:20:45
问题 I'm developing a game that is mixed with winforms (for the map editor). The problem I am facing is that even if the main game window isn't in focus, it still receives mouse change events (such as clicking and moving the mouse). Is there a way to make sure my application is in focus before continuing on to handle these events are is there some kind of built in method? Thanks! 回答1: Use the Game.IsActive property to check if you should deal with mouse and keyboard input. 回答2: If you add a

disable mouse event on 1st and re-enable the same on 3rd click - javascript

回眸只為那壹抹淺笑 提交于 2019-12-08 11:48:15
问题 I have a div which changes colors on multiple onclick events. var linkClick = 1; function update_link(obj){ if (linkClick == 1){obj.style.border = 'solid 1px red'}; if (linkClick == 2){obj.style.border = 'solid 1px blue'}; if (linkClick == 3){obj.style.border = 'solid 1px green'}; if (linkClick >3 ) {obj.style.border = 'solid 1px #555555'; linkClick=0}; linkClick++; } and in html: onclick="update_link(this);" I need onmouseenter and onmouseleave to be disabled when I click the 1st time, and

JavaFX Circle object not registering mouse events properly

我是研究僧i 提交于 2019-12-08 11:19:41
问题 I want the user to be able to drag-move the circles around the pane. The circles dont seem to register (almost) no mouse events (as defined in the end). I have the same exact code for an empty pane it works just fine. Also if I change circle1.setOnMouseDragged to paneForCircles.setOnMouseDragged it works just fine but its not what I want because I need to manipulate both circles. Any ideas ? I would appreciate it if you could also tell me how to hide the part of the circle that overlaps with

How to handle mouse hover event for specific control in Microsoft visual C++ ( MFC )?

谁都会走 提交于 2019-12-08 10:38:13
问题 In my application I need to handle mouse hover event to change the background of a button. Using the MFC class wizard, I couldn't find a mouse hover entry in the list of events for that item. I tried using PreTranslateMessage , but it doesn't work. How can I handle that event? 回答1: Mouse hover events aren't generated by default. You have to request them by calling TrackMouseEvent with a properly populated TRACKMOUSEEVENT structure: TRACKMOUSEEVENT tme = { 0 }; tme.cbSize = sizeof( tme ); tme

A way to get a “button press event” for a WPF ScrollViewer control

廉价感情. 提交于 2019-12-08 09:41:51
问题 My custom control uses a ScrollViewer and I want to determine when the user presses the horizontal scroll increment button while the control is already scrolled to the horizontal max. The viewer contains a canvas and the idea is the canvas will extend if the user tries to scroll past its extent with the buttons. ScrollViewer doesn't appear to have any events which relate to the buttons specifically and ScrollChanged is no use on its own since it doesn't trigger when the bar is at its extent.

collectionView(_:didDeselectItemsAt:) is never called

自古美人都是妖i 提交于 2019-12-08 09:38:50
问题 For some reason, my NSCollectionView (which uses a custom layout that I wrote) calls its delegate's collectionView(_:didSelectItemsAt:) function when I click an item, but not that same delegate's collectionView(_:didDeselectItemsAt:) when I click off it. Here's my basic setup: class MyCollectionViewContainer: NSViewController { fileprivate lazy var collectionView: NSCollectionView = { let collectionView = NSCollectionView() collectionView.delegate = self collectionView.dataSource = self

How to give an dynamicly loaded TreeViewItem an EventHandler?

一笑奈何 提交于 2019-12-08 09:08:34
问题 at the moment i programm a database based Chat System. The friendlist of every User gets loadet in a TreeView after the login. means: After the login I request the names of the useres friends by the following Funktion, String namesSt[] = get.getUserFriendNameByUserID(currentUserID); To use the given Names to load them as TreeItem into my Friendlist / TreeRootItem "rootItem" for (int counter = 0; counter < namesSt.length; counter++) { System.out.println(namesSt[counter]); TreeItem<String> item

How to properly scroll an overflowing div based on mouse position within its container

社会主义新天地 提交于 2019-12-08 07:04:44
问题 I am working on a small jQuery plugin that autoscrolls through a set of overflowing elements within a container div based on the mouse position within that container div. See the Demo Here The idea is for this plugin to be an improvement of something I wrote a while ago. See the autoscrolling navigation in the lower left here The old problem with this was that it jumps around when you mouseenter from anywhere but the bottom(javascript perspective) of the container div. Now everything is

opencv set mouse callback

柔情痞子 提交于 2019-12-08 06:29:31
I'm a beginner in OpenCV and would like to print in my console the specific value of a pixel (RGB format) that I define by clicking on it. After some searches I managed to prind the coordinates of the click I make on the image. If anyone knows how to do that please modify this code that I am using: void mouseEvent (int evt, int x, int y, int flags, void* param) { if (evt == CV_EVENT_LBUTTONDOWN) { printf("%d %d\n",x ,y ); } } and this is what I use to call the function: cvSetMouseCallback("blah blah", mouseEvent, 0); Place your image in a Mat called frame, then: namedWindow("test");

QGraphicsPixmapItem mouseMoveEvent when not grabbing

南笙酒味 提交于 2019-12-08 05:52:32
问题 I am working on a C++ application with Qt 4.8 as the GUI framework: A subclassed QGraphicsView rendering a subclassed QGraphicsScene containing one or more subclassed QGraphicsPixMapItem(s) in which I need to know the mouse cursor's relative pixel position. Following How to show pixel position and color from a QGraphicsPixmapItem I subclass QGraphicsPixmapItem: class MyGraphicsPixmapItem : public QObject, public QGraphicsPixmapItem { Q_OBJECT public: explicit MyGraphicsPixmapItem