mouse

How would you solve this opengl necessity (in c) involving knowing in which square in a boardgame did the user click?

佐手、 提交于 2019-12-11 00:06:06
问题 So I have this board, to play a boardgame... The problem is, how do I know in which square did the user click on? I know the x and y coordinates, but how do I automate it, without the need to hunt down the specific locations of each square. (Also the size of the board is variable...so it can have lots of squares, or very few, but the board has always the same height and width, that is, the same number of squares running from left to right as the number of squares running from top to bottom).

Offset when drawing on canvas

柔情痞子 提交于 2019-12-10 21:18:23
问题 Have a simple drawing application. The problem is in the coordinates ( redraw function): they must be mouse, but are near 2x mouse. What's the problem in the code? <html> <head> <style type="text/css" media="screen"> body{ background-color: green; } #workspace{ width: 700px; height:420px; margin: 40px auto 20px auto; border: black dashed 1px; } #canvas{ background: white; width: 100%; height: 100%; } </style> <script type="text/javascript" src="jquery-1.7.1.js"></script> <script type="text

how to prevent mouse grab while debugging 3D application on a java IDE?

给你一囗甜甜゛ 提交于 2019-12-10 20:13:17
问题 This question was migrated from Software Engineering Stack Exchange because it can be answered on Stack Overflow. Migrated 5 years ago . Most 3D applications grab the mouse. This means the OS cursor is hidden and only the 3D application cursor is shown (and only within the application). In case it is a game, the cursor is completely hidden so you can "look around" moving the camera with the mouse. While I am debugging with Eclipse IDE or NetBeans IDE, the "grab mouse" event happens. When a

JavaFX MousePosition

邮差的信 提交于 2019-12-10 19:59:38
问题 I need to get x and y coordinates of a mouseclick in my application. I partially solved it in the code below by creating a point but I keep getting different coordinates depending on where I move a window of my application on the screen. I would need something constant to identify certain obejcts later. Thank you for your help! @Override public void start(Stage stage) throws Exception { final Pane root = new Pane(); setWidth(1400); setHeight(1000); Canvas background = new Canvas(getWidth(),

How to check for TrackBar sliding with mouse hold and release

微笑、不失礼 提交于 2019-12-10 18:47:24
问题 I have a trackbar in my WinForms program which by moving it a huge and time consuming method will be refreshed. Have a look at this code: trackBar_ValueChanged(object sender, EventArgs e) { this.RefreshData(); } This track bar has 20 steps. If user grab the trackbar's slider and pull it from 20 to 0 in my case, 'RefreshData' will be executed 20 times although it shows correct data when it ends the process that is 'RefreshData' with value 0, I want to do something like it only calls the

How to change Windows cursor in WPF?

邮差的信 提交于 2019-12-10 18:15:32
问题 I like to change the cursor, when user clicks a button. I can use FrameworkElement.Cursor. But it only changes the cursor for my current App. But I need my entire Windows cursor should change. I mean if you move the mouse outside the my app, it should show my cursor (not the default arrow). How to achieve this? 回答1: In order to accomplish this you have to change a registry value then perform an API call, check this MSDN post for more details on how to do it: How to change the system’s cursor

How I can get the “pointer resolution” (or mouse DPI) on Windows?

旧巷老猫 提交于 2019-12-10 18:06:39
问题 experts. How I can query the mouse DPI (pointer resolution) on Windows? I read the article Pointer Ballistics for Windows XP. It says "the typical pointer resolution is 400 mickey/inch". But how I can query the exact value used by various kinds of mice? It would be great if you could also point me to documents related to this topic. Thanks! 回答1: It's impossible to tell. The mouse DPI is simply the number of times the mouse reports a change in location when it's moved by one inch. On the other

Get size of mouse cursor in javascript

て烟熏妆下的殇ゞ 提交于 2019-12-10 17:00:40
问题 I need to determine the width and height of the current mouse cursor used on our webpage. I need to show a div right under the cursor, and possibly to the right of it. So I need to determine the offsets of my div from the exact pointer location, so the cursor do not cover up the div. The mechanism will be used in intranet system, so it can be firefox-only solution. Unfortunatelly some people here use weird cursors, anyway, big ones, so I cannot just hardcode eg, 16px right, 16px top offsets.

TextBlock over a listview: how to ignore clicks in the TextBlock and let the listview handle them

主宰稳场 提交于 2019-12-10 15:45:15
问题 I have a listview which displays a lot of info, but when it's empty I want to overlay a textblock over it which says "No Info to Display" or "Do bla-bla-bla to add info". The listview is set up to respond to mouse clicks, but now if I click on the textblock, those events are routed to the textblock. How can I make these events go to the listview instead? 回答1: IsHitTestVisible = "false" on the TextBlock. 来源: https://stackoverflow.com/questions/6417201/textblock-over-a-listview-how-to-ignore

How to get current type of mouse cursor in Mac OS X?

狂风中的少年 提交于 2019-12-10 14:45:00
问题 How can I get the current type of mouse cursor on screen? (Not only on my app window, globally.) Or is it at least possible to detect whether the default cursor is currently displayed? Either Carbon or Cocoa is OK – or even other working APIs, preferably the official ones. This is what I have tried: NSCursor *sysCursor = [NSCursor currentSystemCursor]; if (sysCursor == nil) { NSLog(@"nil"); } if ([sysCursor isEqual: [NSCursor arrowCursor]] || [sysCursor isEqual: [NSCursor contextualMenuCursor