Wish Allow re-invoking of designer scripts/anchors

Discussion in 'Bugs & wishlist' started by JohnC, Aug 13, 2015.

  1. JohnC

    JohnC Well-Known Member Licensed User

    Hi,

    I usually spend a good amount of time setting up the position of controls in the layouts for different screen size and orientations using the designer script and anchors.

    But it seems the designer scripts and anchors are only executed when the layout is first loaded into a view.

    What would be very cool is if B4A could allow us to programmically re-run the designer scripts and anchor settings. This way if the user pops-up the keyboard, the screen can automatically reposition it's views to optimize for the reduced screen size.

    Right now, to readjust the layout when the keyboard pops-up, we have to duplicate a lot of the view-positioning code that it already in the designer script and anchor settings and place that duplicate code in the activity module. Having duplicate code just makes our job harder because we have to maintain two versions of the same codebase. Since most of the view positioning code is already in the designer script and anchors settings of the layout, it would be just natural and hugely efficient for the keyboard positioning code to also be in here too. And, many times there maybe no need for additional keyboard positioning code because the existing designer scripts/anchors settings might already be able take care of that as-is!

    It's just that right now its not possible to rerun the designer scripts/anchor code unless we remove and reload in the layout when the keyboard pops up. But that's not good because not only does that swapping look ugly, it will loose any info the user entered into one of the views, unless we then save the contents of all the views and reload them in again when we reload the layout - which is even worse.

    So, my wish is to be able to re-run/re-invoke a layout's designer script/anchor settings from my code so all that I would need to do is add an IME event to handle the keyboard popping up:

    Code:
    Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int)
        
    Activity.RerunScriptAnchors
    End Sub
     
    Dave O likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice