Hi all,
I am experiencing what seems a strange or unexpected behaviour on my Samsung Galaxy Tab 2 (GT-P5100) tablet.
Executing the following code it results always in whole values (both X and Y).
Only placing-moving-lifting a finger on the panel leads to decimal values on the UP action (Down stays integer). What happens on your devices and, most important, how do you explain this case?
After a few touches here and there, my log results in:
TIA for your help and comments.
udg
ps: btw, Panel documentation doesn't show "boolean" as the returning type for Touch function; should it be added in any case?
I am experiencing what seems a strange or unexpected behaviour on my Samsung Galaxy Tab 2 (GT-P5100) tablet.
Executing the following code it results always in whole values (both X and Y).
Only placing-moving-lifting a finger on the panel leads to decimal values on the UP action (Down stays integer). What happens on your devices and, most important, how do you explain this case?
B4X:
Sub Process_Globals
End Sub
Sub Globals
Dim pnlTest As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
pnlTest.Initialize("test")
Activity.AddView(pnlTest,10dip,10dip,200dip,200dip)
pnlTest.Color = Colors.Red
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub test_Touch (Action As Int, X As Float, Y As Float)
Select Action
Case pnlTest.ACTION_DOWN
Log("Down -> X: "&X&" Y: "&Y)
Case pnlTest.ACTION_UP
Log("UP -> X: "&X&" Y: "&Y)
Case pnlTest.ACTION_MOVE
Log("Moving -> X: "&X&" Y: "&Y)
Case Else
Log("other action")
End Select
Return True
End Sub
After a few touches here and there, my log results in:
B4X:
Down -> X: 97 Y: 74
UP -> X: 97 Y: 74
Down -> X: 170 Y: 169
UP -> X: 170 Y: 169
Down -> X: 50 Y: 159
UP -> X: 50 Y: 159
Down -> X: 133 Y: 197
Moving -> X: 138.03152465820313 Y: 183.91806030273438
Moving -> X: 143.3489227294922 Y: 171.96493530273438
Moving -> X: 147.5701141357422 Y: 166.64483642578125
Moving -> X: 148.5677032470703 Y: 163.8645782470703
Moving -> X: 149.5 Y: 162
Moving -> X: 150.2666778564453 Y: 160.46664428710938
UP -> X: 150.2666778564453 Y: 160.46664428710938
Down -> X: 154 Y: 52
UP -> X: 154 Y: 52
** Activity (main) Pause, UserClosed = true **
TIA for your help and comments.
udg
ps: btw, Panel documentation doesn't show "boolean" as the returning type for Touch function; should it be added in any case?
Last edited: