Component offset from the visual
Hello !
I just created a new project to test the TC Mobile module 10.
Everything works properly (installation, smartphone emulation, ...).
I just have a problem, because when I use object spy, components are not in the same location as visually.
example: In the Object Browser:
Aliases.Device.Desktop.Height = 1280
Aliases.Device.Desktop.Width = 720
This is the size of the screen => ok
Then I process my application and the first component "RootLayout"
Aliases.Device.Process ("My application"). RootLayout.Height = 1138
Aliases.Device.Process ("My application"). RootLayout.Width = 640
When I make a Highlight on Screen on the component, I have a rectangle but it is smaller than the application.
All components within are also affected.
You had this problem?
Thank you.
Nicolas
PS: I apologize if I made mistakes, I try to improve my English.
Hello,
I found a solution by taking the width and height of the smartphone and I divisie to the width and height of the application to give me a zoom factor :var oMobile = Mobile.Device("RAINBOW"); var oRootLayout = oMobile.FindChild('ObjectType', 'RootLayout', 5); var iCoefHeight = oMobile.Desktop.Height / oRootLayout.Height; var iCoefWidth = oMobile.Desktop.Width / oRootLayout.Width;
I look for the component and a variable, I store the new X and Y coordinates by adding the zoom factor to click in the middle of the component :
var oComponent = oRootLayout.FindChild(new Array('ObjectType', 'textContent'), new Array('TextNode', "Démarrer l'application"), 50); var iComponentCoordinateX = (oComponent.ScreenLeft * iCoefWidth) + ((oComponent.Width * iCoefWidth) / 2); var iComponentCoordinateY = (oComponent.ScreenTop * iCoefHeight) + ((oComponent.Height * iCoefHeight) / 2);
Then I click on the mobile to coordinated X and Y found :
oMobile.Touch(iComponentCoordinateX, iComponentCoordinateY);
Here is a solution if you ever have the problem.
Tanya thank you for your help.Have a great day.
Nicolas