coordinates

WPF TextBox obtain and set caret position from mouse pointer

筅森魡賤 提交于 2019-12-22 11:34:07
问题 I am trying to set TextBox caret position according to the mouse coordinates when hovering over the TextBox. I can obtain the mouse coordinates relative to the TextBox by using Mouse.GetPosition(this.MyTextBox) but I need help translating those coordinates into the caret position. Any help would be greatly appreciated! 回答1: MyTextBox.CaptureMouse(); MyTextBox.CaretIndex = MyTextBox.GetCharacterIndexFromPoint(Mouse.GetPosition(MyTextBox), true); 回答2: MyTextBox.GetCharacterIndexFromPoint(..)

Android EditText's cursor coordinates (absolute position)

心已入冬 提交于 2019-12-22 10:48:33
问题 How can I get the coordinates of the cursor in the EditText ? I am not trying to get the cursor position here but the EditText coordinates of the cursor. In my case, when I send a number via KeyEvent to the EditText, the cursor position (getSelectionStart) is changed, but its location is always at the right of the EditText. I want to know the coordinates of the cursor (the right of the EditText). 回答1: It's a little bit late answer :), but from API level 21 (Lollipop) there is a way to do it:

help in using GPS coordinates, Android

你离开我真会死。 提交于 2019-12-22 09:55:16
问题 I am using this code to get my location and print the coordinates on the screen. package com.example.alpha; import android.app.Activity; import android.content.Context; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.widget.Toast; public class alpha extends Activity { private LocationManager lm; private LocationListener locationListener; /** Called when the activity is first created.

Coordinates of equally distanced n points on a circle in R?

余生颓废 提交于 2019-12-22 08:34:04
问题 I want to get the coordinates of the equally distanced n points on a circle in R. Mathematically the solution is: exp((2*pi * i)*(k/n)) where 0 <= k < n There are many SOF questions to handle this problem. All the solutions are in non-R environments: Evenly distributing n points on a sphere (java, python solutions presented) Generating points on a circle (non-R solution) calculate pixel coordinates for 8 equidistant points on a circle (python solution) drawing points evenly distributed on a

Firemonkey MouseToCell equivalent

与世无争的帅哥 提交于 2019-12-22 08:08:16
问题 In Delphi VCL if I wanted to see which cell (column and row) of a TStringGrid my mouse was hovering over I'd use MouseToCell. This method is no longer in Delphi (XE2) for FireMonkey apps. Does anyone know how I can determine the cell my mouse is over? OnMouseMove has X & Y values but these are screen coordinates and not cell coordinates. Many thanks. 回答1: There's actually a MouseToCell method in TCustomGrid , which the StringGrid descends, but it's private. Looking at its source, it makes use

How to convert window coordinates relative to a specific view?

自作多情 提交于 2019-12-22 07:08:38
问题 Example: I have a CGPoint in window coordinates: CGPoint windowPoint = CGPointMake(220.0f, 400.0f); There is aView which has a superview in a superview in a superview. Somewhere deep in the view hierarchy, probably even transformed a few times. When you get a UITouch, you can ask it for -locationInView: and it will return the coordinates relative to that view. I need pretty much the same thing. Is there an easy way to accomplish that? 回答1: I found a really easy solution: [self.aView

using boost::karma to format latitude/longitude strings

倾然丶 夕夏残阳落幕 提交于 2019-12-22 07:08:10
问题 I need to format double values into coordinate strings that have a very specific format, "DDMMSS.SSX" where: "DD" is the full degrees "MM" is the full minutes "SS.SS" is the seconds with fraction "X" is either "N" or "S" depending on hemisphere The fields need to be padded with zeroes. Spaces cannot be accepted. Examples for the formatting is as follows: 47.2535 ==> "471512.45N" -0.123345 ==> "000724.04S" I have managed to create the following program that does the job. However I have some

using boost::karma to format latitude/longitude strings

♀尐吖头ヾ 提交于 2019-12-22 07:07:13
问题 I need to format double values into coordinate strings that have a very specific format, "DDMMSS.SSX" where: "DD" is the full degrees "MM" is the full minutes "SS.SS" is the seconds with fraction "X" is either "N" or "S" depending on hemisphere The fields need to be padded with zeroes. Spaces cannot be accepted. Examples for the formatting is as follows: 47.2535 ==> "471512.45N" -0.123345 ==> "000724.04S" I have managed to create the following program that does the job. However I have some

Android (x,y) continuous touch (drag) coordinates

戏子无情 提交于 2019-12-22 06:59:05
问题 I'm new to android, and I've been trying for a while to find out how can I retrieve the coordinates of a continuous touch on the screen. for example have 2 vars (x,y) that update in real time as finger moves around. I got it how to find it when the touch is made, but I really don;t get it how to make it return the result after that , when the finger is moving. I've been trying switch statements, while/for loops in different combination with ACTION_MOVE./ UP/ DOWN .. .still nothing. I've found

Obtaining Ipad touchstart coordinates

两盒软妹~` 提交于 2019-12-22 05:45:10
问题 I would like to obtain the coordinates of a touch event on the ipad in javascript. How would I do this? 回答1: I believe this ought to do the trick: var x = event.targetTouches[0].pageX, y = event.targetTouches[0].pageY; Update: Here is an example: <!doctype html> <html lang="en" class="no-js"> <head> <meta charset="utf-8"> <title>Touch event test</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min