[JS] Get Mouse Cursor Position
I have looked through the documentation and forums here and haven't found any reference to getting the cursor mouse position. I see info about text cursor position, but I am looking to capture the coordinates of mouse position. Is that possible with JavaScript (ExtendScript)?
Thanks for any help you can offer.
Dan
I want the script to create a specific sized picture frame on the page. It would be cool to make it at the current mouse position. Yes I can draw the frame myself, but I am trying to automate a tedious process, so having the script create the frame with all the proper options such as size and style will speed things up. I can create it in the middle of the page with the script, and then drag it into position manually, but it would be even better to use the mouse position when the script creates the frame.
Maybe an AppleScript could get the mouse position?
But then how would I pass that to my JavaScript?
Similar Messages
-
hello,
how can i get the position of the mousecursor (in x, y coords relative to the complete screen) if its not invoked by a mouse event (else its easy with event.getX / Y ())?
cu,
cpiomaybe u can get yur cursor position wif a ruler? dun b dumb. u cant get the xypos anyother way. But ofcos if u like the hard way, u can always use another app to capture the mouse positon n let it inform yur main Java app, thru local ports or even use JNI. N i dun c y anyone will wan to do it this way. it oready defeats the purpose of using Java.
-
How can I get a cursor position?
Hi Everyone!
In my TextArea, there is a blinking cursor.
How can I get the cursor position not the mouse position.
Thanks,Thanks JefferyGong!
That is selection index number, not the coordinate point.
I want to know point position.
Gyi -
How to get the cursor position in the text edit box?
Hi, all.
I want to get the cursor position in the text edit box
to insert some data.
But I don't know how to get.
Can someone give me some advice?
BestRegard.
Miya.Hi Miya,
Write your own textSelectionSuite for this.
and use ITextTarget->GetRange() function.
Thanks and Regards,
Yopangjo. -
How to get the cursor position from screen in module pool program
Hi,
I am doing the module pool program, I have one table control in one screen.
I have to give functionality to the user that when the user enters first record in the table control and after filling the last field
when he presses enter the cursor will have to come in the starting field of the second record.
I know the logic , but i m bit confused.
Can any body help me to solve this....
thanksHi,
Check this code,
Write it in the PBO
MODULE SET_CURSOR_WERTKONTRAKT.
MODULE SET_CURSOR_WERTKONTRAKT OUTPUT.
PERFORM SET_CURSOR USING 'VBAP-ZWERT'.
ENDMODULE. " SET_CURSOR_WERTKONTRAKT OUTPUT
FORM SET_CURSOR USING US_FELDNAME.
DATA: DA_TFILL LIKE SY-TFILL.
DESCRIBE TABLE IVBAP LINES DA_TFILL.
FCODE 'Create Position':
==> Cursor to the first free line set to make the new position
Can be created directly
IF DA_TFILL EQ 0.
SET CURSOR FIELD US_FELDNAME LINE 1. -> set cursor position
ELSE.
SET CURSOR FIELD US_FELDNAME LINE 2.
ENDIF.
Product proposal actively
Set ==> cursor in the first row
IF DPP_ACTIVE EQ CHARX AND
XVBAP_UMFANG_OPV IS INITIAL.
in the 'target volume' if available
IF KOPGR_MIT_ZMENG CS TVAK-KOPGR.
SET CURSOR FIELD 'VBAP-ZMENG' LINE 1.
EXIT.
ELSE.
Else in the field 'Order quantity'
SET CURSOR FIELD 'RV45A-KWMENG' LINE 1.
EXIT.
ENDIF.
ENDIF.
Hope it helps you,
Regards,
Abhijit G. Borkar -
How to get the cursor position on a picture?
I'd like to show the cursor position on a picture
which is 400 by 400 pixel size and located at
(0, 0, 400, 400) on a panel. So suppose that the
cursor is at (50, 50), how can the java code know?
Thank you.I am thinking about this, and use something like
JPanel.setFocusable(true). Thank you. -
Is there a way to get the cursor position index of html text field
I'm trying to work on a text pad like MC with "insert text at
position X" and "find and replace" can anyone tell me how to find
the cursor index of an html text field. Selection.getBeginIndex() ,
Selection.getEndIndex(), Selection.getCaretIndex() as far as I know
these methods only work with text and not htmltext.
What I'm trying to do is assign different parts of the string
to variables so that I can combine them to reconstitute my html
string.enfantterrible:
If I understand correctly, you want the corresponding
position in the
htmlText propery of the caret index (which as you point out
is only the
position in the plain text version of the textfield content).
Below is how I would do it. Maybe there's an easier or more
efficient
way (using XML objects etc), but I don't know it. You could
conduct all
your string searches in the plain text and then convert the
result to
the html positions. I didn't build this to accept negative
parameters
for the pos parameter (e.g. from end of string backwards) but
the
function could be adapted to do this too if necessary. The
test data is
not proper html from a text field, but it doesn't really
matter what it
is so long as its formatted correctly. It just separates the
tags from
the content to enable apples with apples comparison.
//some test data
var testStringXML = "<format>Hel<b>lo i can't
t<i>ell you h</i>ow hap</b>py I
am.</format>";
var undecoratedString = "Hello i can't tell you how happy I
am.";
//the conversion function
function findDecoratedPosition(pos:Number, xmlString:String,
test:Boolean):Number {
//anything between '<' and '>' should be excluded from
plain text search.
//create an array of array elements (n=2) consisting of tag
then plain text
//requires correctly formatted xml/html
var tempArr:Array = xmlString.split("<");
for (var aa = 0; aa<tempArr.length; aa++) {
tempArr[aa] = tempArr[aa].split(">");
//remove the first and last elements of the new array (these
are empty)
tempArr.pop();
tempArr.shift();
//find the corresponding plaintext location and calculate
the "decorated" position
var retPos:Number = 0;
var posCount:Number = 0;
for (var aa = 0; aa<tempArr.length; aa++) {
retPos += tempArr[aa][0].length+2+tempArr[aa][1].length;
//+2 allows for missing < and >
posCount += tempArr[aa][1].length;
if (posCount>pos) {
return (retPos+(pos-posCount));
//out of range
return -1;
//test code:
for (var aa = 0; aa<undecoratedString.length; aa++) {
var altPos = findDecoratedPosition(aa, testStringXML);
trace(undecoratedString.charAt(aa)+" in position "+aa+"
plainText equates to position "+altPos+" in the decorated version
["+testStringXML.charAt(altPos)+"]");
} -
Buggy mouse cursor position (Jumps around to random spot on mouse click)
I've only noticed this annoying quirk in photoshop CS4. This only happens when using the tools in photoshop, and not in any other programs.
When using the tools in photoshop, every so often, some times more often then others, the tools will jump to a random place on (and many times FARE off) screen on mouse click. As in the tool is no longer where my mouse is, but is registering elsewheer.
A few examples. Working with the pen tool to line something, click a control point to set it, go to click to set another one and that point is now being dragged around well off my screen even though the mouse pointer is on screen.
Using the brush tool to color something in and click and the brush is coloring fare above my curser.
Select something and the selection is jumping here and there each time, go to crop? Click and drag and the grabed part jumps off screen.
It is random as to when it wants to jump, and where it wants to jump. Some times it happens all the time, others every so often, or times not at all,.
No settings are ever changed reguarding the mouse, it's just random and ONLY in photoshop with using it's tools. My mouse it's self is not jumping, just where the tool is drawing/putting down whatever is.
This jumping also seems to be a rather common thing, as I stream my drawing live at times and when it starts doing this I've had many people comment and remark that their copy also does the same thing. Posting a journal entry about it also resaulted in a lot of replies with people facing the same thing.
Is this a bug in CS4? People have told me to check my mouse settings under the control panel but that shouldn't have anything to do with it when every other program I use does not do this yet photoshop does. Flash don't, dreamweaver don't, illustrator don't. Painter, bryce, max, etc etc none of them do it. Only photoshop and only when I am using a tool. It's effects are still random.Hi,
I have the same problem as well. I don't think it's related to the mouse hardware at all- on mine the mouse curser stays in the same position but Photoshop registeres is elsewhere! If I let go (of holding the mouse button), the mouse is still where I left it. I've had this problem since Photoshop CS4 x64 but the problem still happens on Photoshop CS5 x64 (it was fine at first but after about a month of use now CS5 has started having the same problem).
I've had the problem for a while (almost a year now) and is really annoying! I dont have any tablets, and I've changed my mouse a few times. I am using a laptop with Windows Ultimate x64. It only happens in photoshop, it's fine in Adobe InDesign.
Hopefully someone might come up with a solution!
Thanks to anyone who can help me/us -
ALV-Grid - Get cursor position
Hi,
I replaced the table control in my dynpro with a custom container and placed an ALV-Grid in there.
So, my problem is now to get the cursor position when the user double clicks at the text in a cell.
It´s important for me to know at which position at the text he double clicked.
e.g.:
| Nr |Text |
|----|-------|
| 1|Hello |
| 2|Test |
The user clicks double between the 'e' and 's' at line 2 ('Test').
I need following information:
line 2
column 2
offset 3 (position, where the user clicked)
When I'm using the table control, it's no problem with
the ABAP-statement 'GET CURSOR' and property 'OFFSET',
but I didn't find a method with the same result for ALV-Grid.
Maybe you know a possibility?
Thank you.
Regards from Germanyhello,
go through these links.these links will surely solve your problem.just have a luk.
Get the cursor position row number in a table control.
upper is for table-ctrl
if you are working with alv.you can achieve it by.
call method cl_gui_control=>set_focus
exporting control = w_grid.
w_grid is ur gid name.
go through this link also
Get cursor position from grid
regards,
Shweta
Edited by: Shweta Joon on Aug 20, 2009 1:15 PM -
How to extract the mouse cursor image without using JNI
I want to get the image of the mouse cursor of the system using java. The Robot class captures the screen only, but the mouse icon image is not the part of the screen, so it is not easily detected. But we can get the mouse cursor position using API, but how to get the exact image icon, without using JNI. I don't want to generate my own cursor at that position.
I am building a Remote Desktop kinda app using java..... I want the screen of the remote comp to be viewed on my screen and generate events from my machine to the remote machine. So, I am capturing the screen images of the remote machine. But the cursor is not part of the screen object. i want to extract the cursor image icon from the remote machine to my machine and render the image.
-
Popup tooltip at cursor position
Carl's example at http://apex.oracle.com/pls/otn/f?p=11933:121 works great but it uses the following snippet of code to position the popup div at the right edge of the triggering element.
$x_Style('rollover','left',findPosX(pThis)+pThis.offsetWidth+5);
$x_Style('rollover','top',findPosY(pThis)-($x('rollover').offsetHeight/2)+($x(pThis).offsetHeight/2));Depending on the size of the triggering element, this may not always be desirable.
Is there a way to position the div right where the cursor is? Getting the cursor position in a cross-browser way seems to be a little tricky, any help appreciated.
ThanksThanks, will keep that in mind.
To answer my own question, all I needed to do was pass in the "event" object to the click/mouseover handler so the event handler can use a script like this to get the mouse position and then use that to position the div. -
Help!
I am using JRun3.1 and developing a web interface to a database. In this particular screen, I am using CachedRowSet (I downloaded this and added it to jrun classpath). I am getting "Invalid cursor position" error.
I feel there is a problem with the usebean tag.
This is my code:
what is wrong with this?
<%@ page language = "java" import="java.sql.*, java.util.*, javax.sql.*, sun.jdbc.rowset.*" %>
<%
String indSub = request.getParameter("indSub");
String areaname = request.getParameter("selarea");
%>
<jsp:useBean id="crs" class="CachedRowSet" scope="session" >
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
crs.setUrl("jdbc:odbc:asphData");
crs.setCommand("SELECT siccode, sicdesc from siccode where sictitle = '" + indSub + "'");
crs.execute();
%>
</jsp:useBean>
<%@ include file="header2.htm" %>
<link rel="stylesheet" href="http://localhost:8100/empData/almis.css" type="text/css">
<br>
<br>
<table align="center">
<tr><td class="moduleDesign" align="center">Employers Database</td></tr>
</table>
<br><br>
<font size="+2" face="verdana sans-serif">
<form action="employerDetail.jsp" method="post">
<p><center><font color="Blue">Employers in the �<%= indSub %>� Industry
<br>
SIC Code:�<%= crs.getString("siccode") %>
<br>State: Utah<br>
Region: �<%=areaname %><br>
</font></center></p>
<p>
<b>Description:</b>�<%= crs.getString("sicdesc") %>
</p>
</form>
<jsp:include page="footer2.htm" />
</body>
</html>
srajaman2Never mind!
I have to issue a next() command to get to the first line of the resultset!
srajaman2 -
Cursor position on screen data in module pool programming(urgent)
Hi all,
I developed a module pool program which will save the data after scanning the barcode data.
In my program screen 100 is there which contains field 2dbar. scanned data is comming to 2dbar field.
we r doing scan 4 times.once for vendor number,once for material no. like this.
After 1st scan, vendor number will come to field 2dbar.
Then I developed logic to put comma after each scanned data come to this field 2dbar.
MODULE put_comma INPUT.
CASE OK_CODE.
when ''.
move 2dbar to 2dbar1.
clear 2dbar.
concatenate 2dbar1 ',' into 2dbar2.
*replace 2dbar with 2dbar2 into 2dbar.
move 2dbar2 to 2dbar.
*write 2dbar2 to 2dbar.
condense 2dbar no-gaps.
*move '' to 2dbar.
*set cursor field 2dbar offset 5.
*write
ENDCASE.
ENDMODULE. " put_comma INPUT
By above logic, comma comes to the starting position of 2dbar after each scan. i.e cursor position is coming to the starting position of screen field 2dbar.
Now I need to move the cursor position after the comma position on 2dbar after each scan.
after 1st scan, 2dbar contains
vmotorola
then my logic puts a comma when u put enter on screen 100.
now 2dbar contains
vmotorola,
i should get the cursor position after the comma.but i am getting cursor position before 'v'.so how to move this cursor position beyond comma after each scan.
I added set cursor command but it is not working.plz
What is the logic, I need to put in PAI to move the cursor on selection screen.
Already the logic I have mentioned. with that logic, I can put comma.now I need to add cursor movement logic to move the cursoron on screen field 2dbar.
Plz reply me as it is urgent.
Thanks in advance.
Regards
pabitraCASE OK_CODE.
when ''.
move 2dbar to 2dbar1.
clear 2dbar.
concatenate 2dbar1 ',' into 2dbar2.
move 2dbar2 to 2dbar.
condense 2dbar no-gaps.
len = strlen ( 2dbar ).
len = len - 1.
set cursor field 2dbar offset len.
ENDCASE.
ENDMODULE. " put_comma INPUT -
How to control the cursor position in the Table control in Module pool
Hi,
Can any body tell me how to change the cursor positon from last field of the first record to the
first field of the second record , when user presses enter in the last field in the module pool
programming.
ThanksHi,
Please avoid posting duplicate posts.
Re: how to get the cursor position from screen in module pool program
Nag -
Cursor positions can't extract waveform subset
Hi there,
I'm trying to get two cursor positions on a waveform graph to be the inputs for the code below, which will begin a process that will analyse a subset of the waveform. The two cursors define the start and end point for the waveform (Cursor 0 is the start point, cursor 1 is the end point). However, I'm having issues as Labview keeps telling me that the values I've chosen are not multiple integers of dt. I'm not sure what to set to avoid this problem. I've tried to get the cursor plots to be single plot types so they snap to x values (I assume this is what single plot means) but it's not making any difference. Note that there are 2 plots initially going to this waveform graph (original and average waveform) but the selection should only be from one of them (single plot is assigned to original waveform). Please help!
edit - Just a quick update. I noticed that if I re-run the VI, and activate this part of the VI that takes the waveform subset, I actually get what I want. Therefore, I assume I haven't set something properly in another part of the VI where I have an event structure that updates the cursor positions into numeric indicators. Could this be the issue?
Solved!
Go to Solution.
Attachments:
Clipboard01.jpg 64 KBI've solved the problem. Having both cursors on set to single plot on the original waveform should have prevented this issue, but I didn't notice that I was feeding in another waveform beforehand which automatically changed the assignment of the cursor, causing my issue.
Now the cursors stay fixed on the single plot I want after some tweaking.
Maybe you are looking for
-
Unable to select text in cell with mouse?
Hi everyone, I am not sure where to log this one, let me know if you think there is a better place for this question. A user is unable to highlight the text in the cells/input box using her mouse. She could do that last week so something has changed,
-
Bangla character not displayed correctly
Hi, All I am work in a multilingual project where some bangla character not displayed properly like "block" in Bangla. The exact apperence of block is ব্লক but in my application it appere as breking character I am using the latest build of flex sd
-
Dear All, I have some problem with accessing DataGrid HeaderText, When one column is visable false. "Click on column content and the code will show col # and header name. Do the same After Hide Colun is clicked" Please check the following code <?xml
-
Issue in Partner Profile config for Outbound IDOC
Hi Experts, I have requirement like, When ever there will be any change in a Sales Order an Outbound IDOC will get triggered though a output type. This IDOC will save a file in the Application Server. The Message Type i am using is ORDERS and the Bas
-
Why when searching reminders on iPad ios 8, do random dates appear?
Since iOS 8, when I search my reminders, (I use a list for my shopping list), random dates appear under the item and above the list the item is in. If I look at the individual item in normal view ( after cancelling the search), there is no date set