Recent

Author Topic: Touch coordinates in onclick event  (Read 2391 times)

tango13

  • New Member
  • *
  • Posts: 36
Touch coordinates in onclick event
« on: May 13, 2021, 07:18:14 pm »
Hi,

I'm trying to get the (x,y) coordinates of a user click on a jdrawview object, but I get huge numbers like x=1118832016 and y=1148645732, so I must definitely be doing something wrong.
I am reading the X and Y variables passed to the onClick event.
Can anyone please shed some light on this?
Thank you very much.

loaded

  • Hero Member
  • *****
  • Posts: 824
Re: Touch coordinates in onclick event
« Reply #1 on: May 14, 2021, 07:27:43 am »
Hi, The code below works fine for me.
Code: Pascal  [Select][+][-]
  1. procedure TAndroidModule1.jDrawingView1TouchDown(Sender: TObject;
  2.   countXY: integer; X: array of single; Y: array of single;
  3.   flingGesture: TFlingGesture; pinchZoomScaleState: TPinchZoomScaleState;
  4.   zoomScale: single);
  5. begin
  6.   ShowMessage(floattostr(X[0])+','+floattostr(Y[0]));
  7. end;  
« Last Edit: May 14, 2021, 07:30:05 am by loaded »
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

tango13

  • New Member
  • *
  • Posts: 36
Re: Touch coordinates in onclick event
« Reply #2 on: May 14, 2021, 02:57:22 pm »
Your code works perfectly and helped me to spot a very silly mistake I made  :-[
Thank you very much!

 

TinyPortal © 2005-2018