AutoScale problem

sterlingy

Active Member
Licensed User
Longtime User
Hey Folks,

I have two panels in the designer, and I'm trying to get the to AutoScale, but it isn't working.

My main config is 1280x800 scale is 1.0

here is my script:

B4X:
'All variants script
AutoScaleRate(.3)
AutoScaleAll 'uncomment to scale all views based on the device physical size.

pnlMainQuestion.Left = 0%x
pnlMainQuestion.Right = 80%x
pnlMainQuestion.Top = 0%y
pnlMainQuestion.Bottom = 100%y

pnlMenuBar.SetLeftAndRight(pnlMainQuestion.Right,100%x)
pnlMenuBar.SetTopAndBottom(0%y, 100%y)

When I change the variant to the Nexus 7 setting, 1280x800 scale 1.33

Things do change, but not properly. It seems that the Right edge of the MenuBar panel doesn't stay linked to the right side of the screen. It runs off the edge.

Thoughts?

-Sterling
 
Last edited:

klaus

Expert
Licensed User
Longtime User
The AutoScale function is based on a 'standard' 320*480*160 layout.
If your layout has any other resolution AutoScale will not work properly.
You should have a look at chapter 8.10 AutoScale in the Beginner's Guide ?

Best regards.
 
Last edited:
Upvote 0

sterlingy

Active Member
Licensed User
Longtime User
So your saying that everything has to be designed in 480x360 then use AutoScale? I was under the assumption it didn't matter what the base screen resolution was as long as scale base scale = 1.

-Sterling
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
So your saying that everything has to be designed in 480x360 then use AutoScale?
Yes.


The AutoScale scale factor is based on these equations.

delta = ((100%x + 100%y) / (320dip + 430dip) - 1)
scale = 1 + rate * delta

Where you have 320 and 430 which are the resolution values of the standard layout.
430 = 480 - 50
50 is the height of the two top lines.

Best regards.
 
Upvote 0

sterlingy

Active Member
Licensed User
Longtime User
Ok, I rebuilt my layout in a 480x320 resolution, then started working on the script. Things were going well and scaling to the Nexus, then suddenly things went crazy. I did accidentally move a view on the Nexus, and it seems to have stayed that way. even when running the script, it has no effect to put things back to how they are defined in the script.

Thoughts?
 
Upvote 0

sterlingy

Active Member
Licensed User
Longtime User
I also discovered that the app won't compile. I get an error msg:

Line value: pnlWorkSheetTitleMaster.top(pnlMainQuestion.Top+5dip)
javac 1.7.0_03
src\b4a\example\designerscripts\LS_mainstudent.java:30: error: ';' expected
views.get("pnlworksheettitlemaster").setTop((int)((views.get("pnlmainquestion").getTop())+(5d * scale)))
^
1 error

B4X:
'All variants script
AutoScaleRate(.3)
AutoScaleAll 'uncomment to scale all views based on the device physical size.

pnlMainQuestion.Left = 0%x
pnlMainQuestion.Right = 75%x
pnlMainQuestion.Top = 0%y
pnlMainQuestion.Bottom = 100%y

pnlMenuBar.SetLeftAndRight(pnlMainQuestion.Right,100%x)
pnlMenuBar.SetTopAndBottom(0%y, 100%y)

pnlWorkSheetTitleMaster.top(pnlMainQuestion.Top+5dip)
pnlWorkSheetTitleMaster.SetLeftAndRight(pnlMainQuestion.Left+5dip, pnlMainQuestion.Right-5dip)

lblWorkSheetTitle.SetTopAndBottom(pnlWorkSheetTitleMaster.Top+2dip, pnlWorkSheetTitleMaster.Bottom - 2dip)
lblWorkSheetTitle.SetLeftAndRight(pnlWorkSheetTitleMaster.Left+2dip, pnlWorkSheetTitleMaster.Right - 2dip)
'
lblSubmitAns.Height = 15dip
lblSubmitAns.Top = pnlMainQuestion.Bottom - 25dip
lblSubmitAns.Bottom = pnlMainQuestion.Bottom - 5dip

lblQuestion.SetLeftAndRight(pnlMainQuestion.Left + 5dip, pnlMainQuestion.Right - 5dip)
lblQuestion.Top = pnlWorkSheetTitleMaster.Bottom + 2dip
 
Upvote 0
Top