Android Question How to manually invoke designer script+anchor's

Discussion in 'Android Questions' started by JohnCody, Aug 9, 2015.

  1. JohnCody

    JohnCody Well-Known Member Licensed User

    Erel,

    I have my anchors and designer script all setup for an activity and it works great.

    But, I would like my activity to automatically reposition all the views/controls (based on my designer scripts/anchors) when the software keypad pops up.

    There used to be a Activty.RerunDesignerScript that might have worked (but didn't support anchors), but that function looks like it's no longer supported.

    I notice in another thread that since RerunDesignerScript is no longer supported, you suggested to just remove all views and reload the layout which will rerun the scripts/anchors based on the new (smaller) screen size when the keyboard is displayed. But doing that would require me to first save the state/contents of all the views/controls in the current activity, then remove all views, reload in the layout and then restore the contents of all the views. This not only is visually kind of ugly, it also add programming overhead.

    What would be much more useful is a way to manually initiate the script/anchor's of a layout (that has already been loaded) so it will simply reposition all the views based on my script/anchors for the new screen size, and keep the already user-entered settings/content of all the views.

    Is this possible?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    It is not possible to rerun the script and the anchors. You will need to manually adjust the layout in your code.
     
  3. JohnCody

    JohnCody Well-Known Member Licensed User

    Erel,

    Please try to think about this...

    When I was trying to get scrollview working for a different problem, I could have sworn that during one of my edit versions (trial and error cycles), I'm pretty positive that I got the controls/views in my layout to reposition themselves automatically when the keyboard was displayed.

    What I had was about 6 views on a panel, which made up my layout. I then loaded this panel into a scrollview. I was then doing a bunch of edits/test cycles to get the scrollview working the way I needed, when I remember one of my edits made my layout reposition itself automatically when I popped up the keyboard. But since I was trying to do something else, I did not save/document the code that made this happen.

    So, please think if there might be some way with using a scrollview and/or panel to get a layout to reposition itself (using anchors) without having to reload in the layout.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    If you are using a ScrollView then it is very simple. You just need to change the ScrollView height.
     
  5. JohnCody

    JohnCody Well-Known Member Licensed User

    Hi Erel,

    But that will just reduce the "window" of the scrollview - my panel that is embedded in the scrollview still has all it's views positioned as if the activity is full-height even though the keyboard is shown.

    I would like to have all my views resize/reposition as configured in my designer script and anchors when the keyboard pops up.

    It's seems so inefficient to duplicate/rewrite all the code over gain in an IME_HeightChanged event (and create new code to simulate the anchors) when all my code was already written in the designer script/anchor setups.

    Would it be possible to add the ability to B4A so I could programmically reinvoke the designer script/anchors for my layout without loosing the settings/contents of the views that the end user already entered?
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    This is exactly the purpose of ScrollView. To allow the total layout size be larger than the actual available size.

    Please start a new thread for this in the wishlist forum.
     
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