Lazarus

Programming => Operating Systems => Android => Topic started by: tango13 on May 13, 2021, 07:18:14 pm

Title: Touch coordinates in onclick event
Post by: tango13 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.
Title: Re: Touch coordinates in onclick event
Post by: loaded 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;  
Title: Re: Touch coordinates in onclick event
Post by: tango13 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