Odd design behavior in 2.2

Dman

Active Member
Licensed User
Longtime User
I have been very carefully going through all of my layouts using the autoscale and even putting the x/y positions on everything. I have been using % on every x/y declaration. When I open up my program, the screen looks like the first screenshot but when I click on a button that finishes that activity and starts another one, the screen looks like the second screenshot when I restart that activity from another activity.

If I exit the program and reopen it, it looks like the first screenshot again like it is supposed to.

1.png


2.png
 

JonPM

Well-Known Member
Licensed User
Longtime User
It's hard to say without seeing some code. I haven't used Autoscale yet, but I thought I read somewhere that it only works on dip declarations, not %'s?
 
Upvote 0

Dman

Active Member
Licensed User
Longtime User
I'm sure you mean the design scripts code, right?

B4X:
'All variants script
AutoScaleRate(0.5)
AutoScaleAll

B4X:
'Variant specific script: 320x480,scale=1

lblMenu.SetLeftAndRight(0%x,100%x)
lblMenu.Height = 12%y
lblMenu.Top = 0%y

lblARInvoice.Width = 65%x
lblARInvoice.Height = lblMenu.Height
lblARInvoice.HorizontalCenter= 40%x

btnExit.Height = lblMenu.Height
btnExit.Right = 100%x

btnCreate.HorizontalCenter = 25%x
btnCreate.VerticalCenter = 24%y

Label2.HorizontalCenter = 25%x
Label2.Top = btnCreate.Bottom

btnEdit.HorizontalCenter = 75%x
btnEdit.VerticalCenter = 24%y

Label3.HorizontalCenter = 75%x
Label3.Top = btnEdit.Bottom

btnPayments.HorizontalCenter = 25%x
btnPayments.VerticalCenter = 50%y

Label4.HorizontalCenter = 25%x
Label4.Top = btnPayments.Bottom

btnReports.HorizontalCenter = 75%x
btnReports.VerticalCenter = 50%y

Label5.HorizontalCenter = 75%x
Label5.Top = btnReports.Bottom

btnActions.HorizontalCenter = 25%x
btnActions.VerticalCenter = 75%y

Label6.HorizontalCenter = 25%x
Label6.Top = btnActions.Bottom

btnBackUp.HorizontalCenter = 75%x
btnBackUp.VerticalCenter = 75%y

Label9.HorizontalCenter = 75%x
Label9.Top = btnBackUp.Bottom

Label7.top = Label9.Bottom + 3%y
Label7.HorizontalCenter = 50%x

lvBackup.Width = 60%x
lvBackup.Height = 75%y
lvBackup.HorizontalCenter = 50%x
lvBackup.VerticalCenter = 50%y

ListView1.SetLeftAndRight(0%x,100%x)
ListView1.SetTopAndBottom(0%y,100%y)
 
Upvote 0

JonPM

Well-Known Member
Licensed User
Longtime User
Yes, although it doesn't apply to your issue, I am just mentioning it because your use of Autoscale isn't correct.

Autoscale only affects views like this:
Button.Width = 100dip

not this:
Button.Width = 10%x
 
Upvote 0

JonPM

Well-Known Member
Licensed User
Longtime User
So none of the code you posted is actually affected by the Autoscale you declared in the beginning
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
AutoScale affects only Views defined in the Designer.
All code lines you add after AutoScaleAll (in the Designer or in the IDE) will change the position or dimensions of the given view and overrides its AutoScaling.
In your Designer Script you set the view positions and dimensions with %x and %y after AutoScaleAll overriding it so AutoScale has no effect.
With %x/%y you strech all views on the screen proportionally to the screen dimensions for big screens this might be too large so with AutoScale you can 'play' with the scaling factor. With a rate value less than 1 the scaling is smaller than the 'full screen stretching' and you can adjust this with the rate value.
To understand what's happening in your example we need to see the whole code.

Best regards.
 
Upvote 0

Dman

Active Member
Licensed User
Longtime User
Thanks guys. I am packing up to go out of town this morning and will get back on this when I get back. You all have a nice weekend. :)
 
Upvote 0
Top