Bug? loading 2 pages scaling become crazy

imbault

Well-Known Member
Licensed User
When loading a first page with AutoScaleRate(1) and AutoScaleAll, then a second page, when we show
the first page, it's like the Autoscale had no effect, controls are super big.

in this example
layout1 :
AutoScaleAll

layout2 :
AutoScaleRate(1)
AutoScaleAll

B4X:
    Private Sub Application_Start (Nav As NavigationController)
    Dim nc As NavigationController
    nc.Initialize("nc")

     ' in Sub Process_Globals
     ' Public NavControl As NavigationController

     NavControl = nc

    page1.Initialize("page1")
    page1.RootPanel.LoadLayout("layout1")

    page2.Initialize("HomePage")
    page2.RootPanel.Color = Colors.White
    page2.RootPanel.LoadLayout("layout2")
    page2.RootPanel.Color = Colors.Black
    NavControl.ShowPage(HomeScreen)
if I remove
B4X:
     page1.Initialize("page1")
     page1.RootPanel.LoadLayout("layout1")
no problem
 
Last edited:

imbault

Well-Known Member
Licensed User
Can you post a small project showing the problem so we can see what exactly you have done and test it.
Sure, here it is

if you comment those 2 lines, it's ok
B4X:
Page2.Initialize("page2")
    Page2.RootPanel.LoadLayout("layout2")
 

Attachments

klaus

Expert
Licensed User
What exactly do you want to do ?
You have layout1 with one layout variant 1024 * 768 AutoScaleRate(1) and AutoScaleAll.
Then layout2 with two layout variants 1024 * 768 and 568 * 320 and only AutoScaleAll which means AutoScaleRate(0.3) the defalt value.
Then you add a view in code.
You should define the dimensions of the view, added in the code, in the Page_Resize routine only ther 100%x and 100%y are known.
 

imbault

Well-Known Member
Licensed User
What exactly do you want to do ?
You have layout1 with one layout variant 1024 * 768 AutoScaleRate(1) and AutoScaleAll.
Then layout2 with two layout variants 1024 * 768 and 568 * 320 and only AutoScaleAll which means AutoScaleRate(0.3) the defalt value.
Then you add a view in code.
You should define the dimensions of the view, added in the code, in the Page_Resize routine only ther 100%x and 100%y are known.
I want to show the layout1

Thank you Klaus, can you give me an example to put in the page_resize in order to redimension the layout1 with it's AutoScaleRate(1) and AutoScaleAll.

Patrick
 

klaus

Expert
Licensed User
I want to show the layout1
I don't have enough information.
On what kind of device do you want to display layout1 ?
Before testing I prefer to know in detail what to look at.
 

klaus

Expert
Licensed User
Downscaling form an iPad layout to an iPhone layout seems not to work very well.
The main problem is the different width/height ratio.
Attached you have modified version with layout3 for an iPhone with AutoscaleRate(0.5) and anchors.
Doesn't look too bad.
 

Attachments

Top