Recent

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

tango13

  • New Member
  • *
  • Posts: 30
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

  • Full Member
  • ***
  • Posts: 214
  • Either seem as you are or be as you seem.
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 »
Installing the spelling, google translate is used :)

tango13

  • New Member
  • *
  • Posts: 30
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