I am trying to change the b4xSwitch left and top position using b4xSwitch.mBase.Left & b4xSwitch.mBase.Top but despite the code being executed it does not always move on the screen. I have even tried placing it inside a panel but same effect.
Sub Process_Globals
Private chkGeofence1 As B4XSwitch
End Sub
Private Sub Application_Start (Nav As NavigationController)
MainPage.Initialize("PageMap")
MainPage.RootPanel.Color = Colors.White
MainPage.RootPanel.LoadLayout("main")
MainPage.Title = "Products - Map"
Starter.Initialize
chkGeoFence1.mBase.Top = 5
End Sub
What size is the Panel?
As chkGeofence1 is a child of customview-B4XSwitch, when you change chkGeofence1.Top, the Top value is referenced according to the parent panels upper left corner.
If customview-B4XSwitch has the dimensions of chkGeofence1, then you should change customview-B4XSwitch.Top.
Again without knowing exactly what you have done, in detail, we need to guess it.
Thank you. Yes the Handle Resize Event is False. It does not work first time the applications loads the layout but subsequent refresh the same code works fine. Putting into a resize event clears the problem.
I do not want to move the items. When the layout first loads in the app, they have moved from the layout position. Image 1 is after the app has loaded, image 2 is after a page resize event. The font also changes in the swiftbutton, not done in code. Image 2 is as the layout designer shows.
This is the mistake.
The views at the bottom should be anchored to the bottom.
Start with the visual designer video tutorial: https://www.b4x.com/etp.html
Also check the "handle resize event" and delete the code in the Resize event.