New feature: AutoScale and other new designer script keywords

Discussion in 'Android Questions' started by Erel, Sep 19, 2012.

  1. Erel

    Erel Administrator Staff Member Licensed User

    V2.20 will include the following new designer script keywords:

    - Min and Max - same functionality as the equivalent standard keywords

    Scaling keywords:


    As explained in this thread: http://www.basic4ppc.com/forum/basi...ing-multiple-screens-tips-best-practices.html in most cases you will want to scale the views size and text size based on the device physical size. A naive solution for the size is to use percentage when specifying the dimensions. However the result is a "stretched" UI which in most cases looks bad on larger devices such as tablets.

    The scaling method suggested in the above link can now be easily applied with the following three keywords:
    - AutoScale - Scales a specific view (left, top, width, height and text size are scaled).
    - AutoScaleAll - Scales all views
    - AutoScaleRate - Sets the scaling rate (see the above link for more information)

    Note that AutoScale methods implement the formula internally. It is no longer required to build it in the script.

    The recommended way to adjust your UI is:
    1. AutoScaleAll
    2. Adjust the views location as required
    3. Use SetLeftAndRight and SetTopAndBottom on the views that should fill the available space)
     
  2. metrick

    metrick Active Member Licensed User

    Yes! Yes! Yes!
     
  3. CARTHO

    CARTHO Member Licensed User

    Ooooooh YES !
     
  4. mrjaw

    mrjaw Active Member Licensed User

    WAooooooo!!!!!

    If it is TRUE Erel, will take the place of Wolverine as my new hero!!!!
     
  5. JonPM

    JonPM Well-Known Member Licensed User

    Icon clap :)
     
  6. mrjaw

    mrjaw Active Member Licensed User

    When this version is come out ?
     
  7. Inman

    Inman Well-Known Member Licensed User

    Wow! I got to learn designer scripts and abstract designer. I always manually created views with code and scaled them with %x and %y. This AutoScale sounds much simpler.
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    Version 2.20 should be released in a few weeks.
     
  9. AscySoft

    AscySoft Active Member Licensed User

    Can't wait! Super!
     
  10. raiker

    raiker Member Licensed User

    :sign0098:
     
  11. pluton

    pluton Active Member Licensed User

    Great work Erel
     
  12. Hubert Brandel

    Hubert Brandel Active Member Licensed User

    Nice to hear :sign0060:
     
  13. Dominex

    Dominex Active Member Licensed User

    :sign0098:
     
  14. MaxApps

    MaxApps Active Member Licensed User

    Hi Erel

    When using AutoScaleAll and AutoScaleRate(1.0) then whole screen is pushed approximately 10% to the right (tested on SG3 and Acer A501).
    Any Ideas?

    Apart from the 10% to the right, it makes it so easy, that support all screen sizes. Especially the text size has been a constant worry for me.

    Can you give an example of how to use Min/Max?

    Kind regards
    Jakob
     
  15. Erel

    Erel Administrator Staff Member Licensed User

    I don't recommend you to use a rate of 1.0. It is too high. The offset happens because the height / width ratio on this device are a bit different than on the "base" variant ratio.

    Code:
    Button1.Width = Min(30dip, Button2.Width)
     
  16. Dman

    Dman Active Member Licensed User

    So the only thing we need in the designer scripts page is the keyword AutoScaleAll and then set the left,right,top and bottom for the views that fill the whole screen?
     
  17. Erel

    Erel Administrator Staff Member Licensed User

    AutoScale and AutoScaleAll scale the left, top, width, height and text size of the the views.

    You may also need to set the position of some of the views. For example if you want to "dock" a button to the right side then you will need to call:
    Code:
    Button1.Right = 100%x
     
  18. Dman

    Dman Active Member Licensed User

    Thanks!
     
  19. junaidahmed

    junaidahmed Active Member Licensed User

    Currently I am working in Samsung Galaxy Tab 8.9 with resolution 1280 X 800 (160 dpi),now i am testing the same application with AutoscaleAll new feature (Basic4Android 2.20) in Samsung Galaxy Note 5.3 with resolution 1280 X 800 (240dpi),but the layout has changed as too big.pls advise how to solve this issue.
     
  20. Inman

    Inman Well-Known Member Licensed User

    Does AutoScaleAll work on views that are added by code on run time and not designer?
     
Loading...