mouseevent

Is it possible to work out where in a p's text a mouse click event occurred?

倾然丶 夕夏残阳落幕 提交于 2019-12-04 05:03:52
I have a <p> containing text. When the <p> is clicked on, I create a <textarea> containing the text from the <p> . Is it possible to calculate where in the <p> 's text the click occurred, and move the <textarea> 's cursor to that same point? I don't believe so, no. The DOM just knows what containing element received the click event, it doesn't distinguish between pieces of text within the containing element unless they are elements themselves. And I doubt you want to wrap every character in your text with its own element tag :) Hope this simple example helps: <html> <head/> <body> <script type

Sending mouse or touch events to VirtualBox VM from host shell?

三世轮回 提交于 2019-12-04 04:48:11
问题 I know how to send keyboard events (keystrokes) to a VirtualBox Virtual Machine, using VBoxManage controlvm keyboardputscancode <scancode> <scancode> <etc...> Is there a similar way to simulate mouse or touch events ? For example, move the mouse to a certain coordinate or over a certain distance, or send a mouse click, or send a touch/tap on a given coordinate? 回答1: You can do this using Python from vboxapi import VirtualBoxManager mgr = VirtualBoxManager(None, None) vbox = mgr.getVirtualBox(

Changing the mouse pointer in JtextPane

别说谁变了你拦得住时间么 提交于 2019-12-04 04:35:13
问题 I have a JTextPane which has the content type text/plain . I set some texts to that JTextPane and it contain some texts which display URLs . I want to change the mouse pointer when I point the mouse to that text only into the hand pointer. Is this function achievable? Note: I have the content of the JTextPane as text/plain . It cannot be changed to text/html thanx 回答1: You could try this: pane.setCursor(new Cursor(Cursor.HAND_CURSOR)); Where pane is your JTextPane . 回答2: Did you read my

jQuery mouseover and mouseleave drop down menus

大城市里の小女人 提交于 2019-12-04 03:58:04
The following displays a menu: <a href="#" id="cityclick">ONZE WAARDEN</a> <div id="citydrop"> <div class="dropbottom"> <div class="dropmid"> <ul> <li><a href="#">FAQ</a> </li> <li><a href="#">ITC</a> </li> <li><a href="#">CLUB</a> </li> <li><a href="#">CULTUUR</a> </li> <li><a href="#">ROBITICA</a> </li> </ul> </div> </div> </div> The jQuery for is as follows : $("#citydrop").hide(); $("#cityclick").mouseover(function () { $("#citydrop").slideDown('slow'); }); $("#citydrop").mouseleave(function () { $("#citydrop").slideUp('slow'); }); PROBLEM: I'm not able to figure out how to toggle the

Possible? — A div overlay which is completely ignored by mouse events (so that mouse events effect only the div below)

你。 提交于 2019-12-04 03:49:53
I have a google map in an iframe and wrapped in a div. Above that div, i have another, which serves to create a recessed shadow effect. The problem is that this overlayed div will take priority of any mouse events, so it renders the interactive google map below useless. There must be a way I can make the overlayed div ignore mouse events, letting the div below get them. (please, please!) Or, is there another way to do it? here's the code being output: <div id="pageWrapper" style="display: block; "> <div class="page_content"> <div id="pageShadow"></div> <div id="pageMap"><p><iframe width="1096"

Getting mouse click location of a label in qt

跟風遠走 提交于 2019-12-04 02:45:12
I googled around and found this forum thread in which the OP seems to have had the exact problem I am having. The question is, how would I inherit from QLabel and reimplement the mousepressed event? I'm guessing it would be something like this: class CustomLabel : public QLabel { public: //what about the constructors? void mousePressEvent ( QMouseEvent * ev ); } void CustomLabel::mousePressEvent ( QMouseEvent * ev ) { QPoint = ev->pos(); //I want to have another function get the event position. //How would I achieve this? It's void! //Is there perhaps some way to set up a signal and slot with

How to wire up a click event for a custom usercontrol button? Should I use CustomControl?

假如想象 提交于 2019-12-04 02:43:24
I wanted to create a button that had an image and a textblock as content. So I went about looking for an answer and found a post ( Reusable Custom Content for Buttons ) which told me to create a usercontrol. I did this and it works great. I can set the image source and text through dependency properties. However, I am stuck as there is no click event for my control. I did a little more digging and concluded that I probably need a CustomControl derived from Button. Is this correct? Or would it be better to wire up a click event to my UserControl? Here's my UserControl: <UserControl x:Class=

how to draw a shape on top of a playing video by clicking a mouse button in opencv python

半世苍凉 提交于 2019-12-04 02:00:05
问题 Well, to begin with, I should admit that it is a pretty long question and I failed to find possible solutions through googling I have a video in which an intruder tries to intrude into the other side of the fence. I can track the intruder, but when he is in the other side, I should be able to save the intrusion duration into a file. The intrusion area would be something like this I thought these steps: I. Reading a video file; II. Getting the very first frame displayed, 1. Pausing the video

Identifying Swing component at a particular screen coordinate? (And manually dispatching MouseEvents)

ぃ、小莉子 提交于 2019-12-04 00:12:53
问题 I'm doing some work making a Java app compatible with alternative input devices. Unfortunately, the device in question has a Java API that's barely into the alpha stages right now, so it's pretty poor. What I need to do is essentially set up a replacement structure for the dispatch of MouseEvents. Does anyone know if there's a way in Swing to take a screen coordinate and find out what Swing component is displayed on top at that screen point? 回答1: In AWT Container, call this ...

Double click to Windows form in C#

ぐ巨炮叔叔 提交于 2019-12-03 21:47:06
How can I detect, which mouse button have double clicked the form i.e. Left, Right or Middle? Updated: I am using .NET2.0 Store the last clicked button in MouseUp event and then check that in the double click event. Sample code: MouseButtons _lastButtonUp = MouseButtons.None; private void Form1_MouseUp(object sender, MouseEventArgs e) { _lastButtonUp = e.Button; } private void Form1_DoubleClick(object sender, EventArgs e) { switch (_lastButtonUp) { case System.Windows.Forms.MouseButtons.Left: MessageBox.Show("left double click"); break; case System.Windows.Forms.MouseButtons.Right: MessageBox