does "set the screenmouseLoc" work on mobile?
Posted: Thu Mar 06, 2025 9:42 pm
I have a stack with a field "text" and a button. (The stack is attached.) The button has the following code in it:
On Windows, the mouse cursor is now at the first character position of the text in field "text" just like you would expect. The "put" statement at the end outputs two identical sets of coordinates.
Can you set the screenMouseLoc on a mobile device? The docs don't say anything about this being read-only on mobile. What am I missing?
Code: Select all
on mouseup
local tTopLeft
put the globalloc of the topleft of fld "text" into tTopLeft
set itemdel to comma
add the margins of fld "text" to item 1 of tTopLeft
add (the effective textheight of fld "text" div 2) to item 2 of tTopLeft
set the screenmouseLoc to tTopLeft
wait 100 milliseconds with messages
put tTopLeft && colon && the globalloc of the mouseLoc
end mouseup
But if I run the same same code on Android, the final "put" statement outputs the position of where the cursor was set, but second set of coordinates, where the cursor actually is, is always where I clicked on the button to run the code.184,136 : 184,136
I've increased the wait time to ridiculous numbers; it doesn't matter. I've also tried running it from a handler where I don't touch the screen to run it, like "orientationChanged". In that case, when I rotate the device to trigger the handler, the mouseloc reports the last place I did touch the screen.8,40 : 134,330
Can you set the screenMouseLoc on a mobile device? The docs don't say anything about this being read-only on mobile. What am I missing?