mouseevent

HTML content only scrolls with scrollbar, not mouse wheel

陌路散爱 提交于 2019-12-05 06:24:35
I have a <div> on my page with a fixed height, and overflow-y: scroll; set so that the content will scroll when it passes the bottom edge of the <div> . Nothing out of the ordinary. For some bizarre reason, the mouse wheel will only scroll the content if the cursor is over empty space in the <div> or if it's over the scrollbar itself. If the cursor happens to be over any of the text content in the <div> , the mouse wheel won't do anything. This happens in both Firefox and Chrome, so it isn't just a quirk of a particular rendering engine or something. The <div> in question is overlaid on top of

D3: How to handle zooming and tooltips in a single chart?

删除回忆录丶 提交于 2019-12-05 06:10:53
I have a visualization that is essentially a series of stacked bar charts, each of which contains several panels. For example, here are three such bar charts, each with four panels. I have managed to implement pan/zoom functionality that is coordinated across the charts. This is what it looks like if I zoom into the third panel from the last image, for example. The zoom behavior is called from an invisible rectangle that is placed over each chart. My problem is that I want to enable tooltip functionality based on the location of the user's cursor within a plot. Since the zoom-rectangles are

How can I add a listener on the ok button of JOptionPane? [duplicate]

删除回忆录丶 提交于 2019-12-05 06:08:54
This question already has an answer here: Java Dialog - Find out if OK is clicked? 4 answers How can I add a listener on the click of "OK" button of JOptionPane.INFORMATION_MESSAGE . My JOptionPane is: JOptionPane.showMessageDialog(null, "Your password is: " + password, "Your Password", JOptionPane.INFORMATION_MESSAGE); The showMessageDialog method returns void when the user closes or clicks ok. But you can use the method JOptionPane.showOptionDialog with a single DEFAULT_OPTION for the OK button. The showOptionDialog will return 0 if OK was clicked and -1 if the user closed the dialog. int

Keep mouse inside a div

╄→гoц情女王★ 提交于 2019-12-05 05:40:41
I have a div of say 100px,100px dimensions, onmousedown I want to move an object inside this div and want the mouse should not point anywhere else except that div so that my object is placed in the div. Mouse will be back to normal onmouseup . What should be the javascript to keep the mouse inside that div only? Elieder It's not possible to control mouse position with Javascript; but you can take his position to control the object that you want... here a simple code that almost do this: <html> <body> <div id="divID" style="width: 100px; height: 100px; position: absolute; left: 250px; top:

How to check if two controls are overlapping in Windows Forms

别来无恙 提交于 2019-12-05 05:12:35
I have created a class that allows the user to drag panels on a forms. How can I ensure that the user does not place two panels on top of each other? If they do, I would like to shift/or highlight one of the control while they are both overlapped. I tried setting this in OnMouseDown event but that didn't quite work. Also, the number of panels on the form vary depending on the number of pictures the form needs to show. Each panel has a picturebox inside the panel. A much better approach is to use the Rectangle.Bounds.IntersectsWith method, which does the check for you and can produce cleaner

How to move items with in VBox(Change order by Dragging) in JavaFX?

你。 提交于 2019-12-05 04:03:55
问题 i want to drag TitledPane with in a VBox.I have n number of Titlepane's in a VBox. I want to change the order of them when dragded.I tried with some of MouseEvents and DragEvents. But its not working for me. But i need the indexes of which Titledpane is moved to which place. Based on that i need to do something in backend. Please help me. Thanks 回答1: This works for me... private static final String TAB_DRAG_KEY = "titledpane"; private ObjectProperty<TitledPane> draggingTab; @Override public

How many pixels are scrolled on a website with a mouse wheel down event?

爱⌒轻易说出口 提交于 2019-12-05 03:43:39
I'm working on writing a custom scrollbar and am catching the mousewheel event. I'm using this to then adjust the scrollTop of the element I want to scroll on. Is there a standard number of pixels that are scrolled down, or does it vary from system to system? I'm showing 114px in the latest build of Firefox: Many mouse drivers let you set the distance scrolled by the mouse wheel, so there is not a standard distance. I'd try your code out for a while and pick a distance that keeps you from scrolling all day but doesn't jump a mile at each scroll. You'll kind of need to "feel" it out. Get

How to make absolute positioned image area maps clickable with mouse?

梦想的初衷 提交于 2019-12-05 02:38:47
I have several images positioned on top of each other using absolute positioning. These images are partially transparent, and have a html area and map to make only the visible parts clickable. In jQuery, I have attached mouse events to the area tags. This works well for one image: mouseenter and mouseleave fire only when the mapped part of the image is entered. The problem is that it only works for the top image. For all others, it doesn't fire events not does CSS hover work, because there is another image on top of it. This despite the fact that the area s do not overlap and map s are in

Using ncurses to capture mouse clicks on a console application

流过昼夜 提交于 2019-12-05 02:11:25
I'm making a console application for unix platforms, and I'm using the curses (or ncurses) library to handle keyboard and mouse input. The problem is that I've found very little documentation on how exactly to use it for that, appart from this page and this one , which don't have very detailed examples. I've managed to capture the left click, but I can't get it to work for the right click because the options menu for the terminal emulator appears at the cursor location, but the event is not processed by the application. How can I avoid this and have the event captured in the application? I

When are tunneling and bubbling events useful in WPF?

笑着哭i 提交于 2019-12-05 01:03:53
I understand how bubbling and tunneling works. However, i'm confused about using them. Here is why: I want to handle a mouse click event. To bubble it, there is MouseDown and, to tunnel it, there is PreviewMouseDown . However, MouseDown doesn't necessarily mean the user clicked the control. May be the user pressed the button and moved away from it to cancel the click. I wouldn't want to change anything if the button is not being clicked. So my question is, how are the Bubbling/Tunneling strategies useful? If the event is listed RoutedEventArgs , then it's routed event. Routed events support a