Douglas Farias Expert Licensed User Longtime User May 2, 2019 #1 Hi all. How can i convert x and y as float to percentage? i have this panel Code: Sub pFundo_Touch (Action As Int, X As Float, Y As Float) Log(x) End Sub i get this numbers when i log the (x) 953.1174926757812 Click to expand... how can i convert this number to %x or the y to %y? all devices log diferent number on x and y, i think this is based on DIP. thank you
Hi all. How can i convert x and y as float to percentage? i have this panel Code: Sub pFundo_Touch (Action As Int, X As Float, Y As Float) Log(x) End Sub i get this numbers when i log the (x) 953.1174926757812 Click to expand... how can i convert this number to %x or the y to %y? all devices log diferent number on x and y, i think this is based on DIP. thank you
Erel B4X founder Staff member Licensed User Longtime User May 2, 2019 #2 Code: x / 100%x * 100 Upvote 0
E emexes Expert Licensed User Longtime User May 2, 2019 #3 You sure you need to convert it to % of screen? It feels like you're about to use the coordinates to plot stuff on the screen, in which case you might be better off leaving them as pixels, rather than converting back and forth. Plus, pixels unlikely to be square in % units (although physical pixels might not be quite square either, but nowadays they're usually pretty close). Upvote 0
You sure you need to convert it to % of screen? It feels like you're about to use the coordinates to plot stuff on the screen, in which case you might be better off leaving them as pixels, rather than converting back and forth. Plus, pixels unlikely to be square in % units (although physical pixels might not be quite square either, but nowadays they're usually pretty close).