How to change code 2.02 to 2.20 about AutoScaleAll?

Theera

Well-Known Member
Licensed User
Longtime User
Hi Klaus,
Excause me to refer to you. The old coding is corrected for B4A2.02,after I changed to be B4A2.20,it is not corrected. I change the old coding to use AutoScaleAll feather in the script.

Best Regards
Theera
:sign0013:
 
Last edited:

Theera

Well-Known Member
Licensed User
Longtime User
Use AutoScale() instead of AutoScaleAl

Hi Klaus,
if I use AutoScale() instead of AutoScaleAll,it's work. Why does not AutoScaleAll work? How to use AutoScaleAll feather?

Best Regards
Theera
 
Last edited:
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Rotate device have error to show layout1 to be layout11

Hi Klaus,
After use b4a2.20,I test rotate device,but it's not change layout1 to be layout11.I think the autoscale() is not supported my widget too.but If I return version 2.02 without autoscaleall and autoscale() is corrected.
P.S. Picture attached is shown error for me after edited layout11'script with using AutoScale().
Best regards
Theera
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
Several problems in your code:
- You don't use any AutoScaleAll function in any of your layouts.
- Your layout is based on the variant 400 x 800 scale 1, AutoScale is based on the standard layout variant 320 x 480 scale 1. AutoScale will not work with your layout.
- As all your views in your layouts are defined with %x and %y AutoScale has no effect on this.
- When you load layouts where you have defined Panels you must not initialize these Panels once again in the code !

Best regards.
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
What that I'm thinking?

Hi Erel and Klaus,
@Erel ,I'm sorry if my English langauge make you mistake. I mean that Whenever I change portrait to landscape by press Ctrl+11 . It should changed another layout(layout1 to layout11)
@Klaus,If the delvelopler use 320*480,Scale=1(160dpi) then I think that
100%x=320 and 100%y=480 ,but If the delvelopler use 480*800,Scale=1(160 dpi) then I think that 100%x=480 and 100%y=800. In another hand for landscape, If the delvelopler use 480*320,Scale=1(160dpi) then I think that
100%x=480 and 100%y=320 ,but If the delvelopler use 800*480,Scale=1(160 dpi) then I think that 100%x=800 and 100%y=480. Everything I do.I plan on paper before fit howmany for %x,and%y
Therefore The delvelopler should have alternative to design of layout's size.

P.S. I'm sorry, If my English is not clearly,Please try to use B4A 2.02 with my program attached post #1 without AutoScaleAll feather.


Best Regards
Theera
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
You are almost right with the 100%x and 100%y values.
The only difference is in 100%y, this value will return the real space on the screen that means minus 50 pixel (sacle 1) for the two top lines.

But if you want to use the AutoScale function the original layout MUST be 320 x 480 scale 1 or 480 x 320 scale 1 !

Best regards.
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Hi Erel and Klaus,
Thank you for kind of you. I must design following Klaus' guide. However I need Erel help developlers could design other variant sizes.Not fix only 320*480,Scale=1(160 dpi) for portrait or 480*320,Scale=1(160 dpi) for landscape. Because I think them are smaller than designer.

Best Regards
Theera
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
How to change layout1 to layout11

Hi Klaus,
I just change designer all of layouts based on 320*480,Scale=1 (160dpi) for Portrait and 480*320,Scale=1(160dpi) for LandScape follows your guide.
I have code belows that detect portriat or landscape.
B4X:
If Activity.Height > Activity.Width Then  
           'For Portrait done
           PnelLayOut1.Initialize("")      
            Activity.LoadLayout("Layout1")
         PnelLayOut1.Visible=True
   
         'set resize 100% for all Tablet devices
         PnelLayOut1.Width=100%x
         PnelLayOut1.Height=100%y
      
   Else 
           'For Landscape done
            PnelLayOut11.Initialize("")                     
            Activity.LoadLayout("Layout11")
         PnelLayOut11.Visible=True
   
         'set resize 100% for all Tablet devices
         PnelLayOut11.Width=100%x
         PnelLayOut11.Height=100%y
      
   End If

After it run ,it 's not change Layout1 to layout11?

Please explain to me.

Best Regards
Theera
 
Last edited:
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
I already told you in post #6 when you add views with a layout you must NOT initialize these in the code.
You must remove :
PnelLayOut1.Initialize("")
and
PnelLayOut11.Initialize("")

Best regards.

Hi Klaus,
If I add views with coding then I must initialize these in the code,Right?
After finished removing,Why does it not shown as layout11? it still be shown as layout1's rotatation?

Best Regards
Theera
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Can you post your latest project to see what happens.
If I add views with coding then I must initialize these in the code,Right?
Yes, sure !

But in the code from post 1 the Panels are in the layout files.

Best regards.
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Built by B4a 2.02

Hi Klaus,
If I turned use B4A2.02 ,it is corrected as pictures,I think that B4A2.20 's AutoScaleAll featheris not completely.
Best Regards
Theera
 
Last edited:
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Lastest file

Can you post your latest project to see what happens.Yes, sure !

But in the code from post 1 the Panels are in the layout files.

Best regards.

Here you are,Klaus
 
Last edited:
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Original File for 2.02

Hi Klaus,
This is original file for 2.02 with my strategy. Here you are

Best Regards
Theera
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
Attached you find a slightly modified version.
- I removed the 480 x 800 layout variants.
- Your layout seem to be designed for FullScreen with title bar, but in the IDE this was not set.
- The layout for 480 x 800 density 1.5 doesn't look good because the scale is a little too big.
- In your case I use a rate value of 0.9, you can play with this value.
- I commented out the animation instructions for testing.

Perhaps in your case remaining with %x and %y would be a good solution.

Best regards.
 

Attachments

  • Lastestfile1.zip
    48.9 KB · Views: 200
Upvote 0
Top