Android Question CONVERT Value X,Y IN Panel_Touch TO Inches

tamba sylvester

Member
Licensed User
Longtime User
I need a way to get Values when a user touches panel to Inches

Value to Inches:
Private Sub panel_Touch (Action As Int, X As Float, Y As Float)

    Log(x&","&y)
'Need this x and Y to be in Inches

    'Log(y)
    'Log(x)
End Sub

when a user Touch on Panel the x and Y value to be in Inches
 

emexes

Expert
Licensed User
I need a way to get Values when a user touches panel to Inches

Give this a burl:

Panel Touch Event:
Private Sub panel_Touch (Action As Int, X As Float, Y As Float)
	Dim DPI As Float = 160dip
	
	Dim Xinches As Float = X / DPI
	Dim Yinches As Float = Y / DPI
	
	Dim Xcentimetres As Float = Xinches * 2.54
	Dim Ycentimetres As Float = Yinches * 2.54
	
	Log("x, y = " & X & ", " & Y)
	Log("x, y = " & NumberFormat2(Xinches, 1, 2, 2, False) & """, " & NumberFormat2(Yinches, 1, 2, 2, False) & """")
	Log("x, y = " & NumberFormat2(Xcentimetres, 1, 1, 1, False) & " cm, " & NumberFormat2(Ycentimetres, 1, 1, 1, False) & " cm")
End Sub
 
Upvote 0
Top