Android Question Layout problem using Scrollview with v7.30

Turbo3

Active Member
Licensed User
Longtime User
The last couple of days I have been struggling to migrate my app from v6.50 to v7.30. I finally got it to compile on a test machine running XP while I keep my production app on my Windows 10 laptop.

The compiled 7.30 version looked and ran OK until I got to the Settings screen.

I have attached three screenshots.

- How the Settings screen looks when compiled with v6.50
- How the Settings screen looks when compiled with v7.30
- Settings screen as viewed in Designer running on v7.30 which looks correct as it matches the v6.50 layout.

As you can see there are layout problems when the app is compiled with v7.30 but not when view on designer.

Since the WYSIWYG view in the designer for v7.30 looks correct I don't understand why the compiled version looks so different.

Any ideas what I need to do to fix this?

App v6.50 a.png App v7.30.png Designer v7.30.png
 
Last edited:

BillMeyer

Well-Known Member
Licensed User
Longtime User
The only thing that I think could be the problem is that on your designer under your Script - General you have a conflicting script that is re-arranging these screens.

To seek this problem, firstly click on your first variant and make sure that your presented screen looks correct - then check the script in Script - Variant, do this for all the screen variants you have.

Then check your anchors (if you have used them) - they could also be your culprits - what I usually do is remove all anchors - layout the screen - then put all my anchors back and then on the Script - General Pane press F5 or the Run button to check what the effect is on my design.

I could be barking up the wrong tree - but try this - it might help.
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
Screenshots next to impossible to see on a tablet
 
Upvote 0

Turbo3

Active Member
Licensed User
Longtime User
The only thing that I think could be the problem is that on your designer under your Script - General you have a conflicting script that is re-arranging these screens.

To seek this problem, firstly click on your first variant and make sure that your presented screen looks correct - then check the script in Script - Variant, do this for all the screen variants you have.

Then check your anchors (if you have used them) - they could also be your culprits - what I usually do is remove all anchors - layout the screen - then put all my anchors back and then on the Script - General Pane press F5 or the Run button to check what the effect is on my design.

I could be barking up the wrong tree - but try this - it might help.
The designer screen is after pressing F5 which runs the script.

Keep in mine this has been working just fine for the last 3-4 years on all versions of B4A up through v6.30 and is only having a problem now when compiled with v7.30.

This is not a new layout. It has been working since B4A v2.52 and this is the first time I have seen such a problem after going to a new version of B4A.
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I can see two different Themes in the Screens. One with the old theme, one with new theme.
I guess the probematik text on the right screen came from the radiobutton.text which is set.... Change the text to be ""

the upper uses rb.text = "rbtBCT" and the other uses rb.Text = "rbtKW"
 
Upvote 0

Turbo3

Active Member
Licensed User
Longtime User
I replaced the first screen which came from v6.50 with the one that exactly matches the data used to generate the other two screens.
 
Upvote 0

Turbo3

Active Member
Licensed User
Longtime User
I can see two different Themes in the Screens. One with the old theme, one with new theme.
I guess the probematik text on the right screen came from the radiobutton.text which is set.... Change the text to be ""

the upper uses rb.text = "rbtBCT" and the other uses rb.Text = "rbtKW"
Not sure I understand. The last screen is from run B4A v7.30 Designer using the WYSIWYG function and taking a screenshot of the resulting image.

Can you explain "different Themes"? All screens are using the exact same .bal file. Two from the running app (v6.5 & v7.3) and the other from designer WYSIWYG (v7.3).
 
Upvote 0

Turbo3

Active Member
Licensed User
Longtime User
It did not take too long to find the problem area. The Settings screen scrolls and it is this code that seems to cause the problem.

Without this code the Settings screen displays correctly but you can only see the top section of the Settings screen. I need it to scroll down to see all the options on this very long screen. This also explains why none of my other screens have a problem as none of them scroll.

B4X:
scvSetup.Initialize(0)
Activity.AddView(scvSetup,0,0,100%x, 100%y)
scvSetup.Color = Colors.RGB(0, 0, 255)
scvSetup.Panel.LoadLayout("setup")
scvSetup.Panel.Height = pnlDebug.Top + pnlDebug.Height
Activity.Title="Settings"
 
Upvote 0

Emme Developer

Well-Known Member
Licensed User
Longtime User
Here is a small project showing the problem.
Seems that when you try to add the layout in Scrollview.Panel, you don't know the size of scrollview panel. You can solve by editing the code in this way
B4X:
    scvSetup.Initialize(0)
    Activity.AddView(scvSetup,0,0,Activity.Width, Activity.Height)
    scvSetup.Color = Colors.RGB(0, 0, 255)
    Dim p As Panel
    p.Initialize("")
    scvSetup.Panel.AddView(p,0,0,scvSetup.Width,scvSetup.Height)
    p.LoadLayout("setup")
    scvSetup.Panel.Height = pnlDebug.Top + pnlDebug.Height
    p.Height = pnlDebug.Top + pnlDebug.Height
    Activity.Title="Settings"
 
Upvote 0

Turbo3

Active Member
Licensed User
Longtime User
Thank you very much for the new code. After making the changes the test app runs ok. Compiling the full app which takes a while on my old XP laptop.

Is there a reason why the old code worked ok for the last four years and now needs to be updated when going to B4A 7.30?

--------------------------------
Full app now runs just fine.

Again, thanks for all the help.
 
Last edited:
Upvote 0

Turbo3

Active Member
Licensed User
Longtime User
I'm not sure what exactly changed that caused this behavior (v6.30 is quite old now). It's probably related to the anchors feature. Anyway it is a mistake to load a layout to a zero size panel.
It has been over 4 years since that code was put in so I don't recall how I came up with it. I guess it was like a landmine waiting to go off which it finally did for me.

I have been wanting to move up to the latest version but did not have the time until now to work through all the changes need (new java, zipalign, okhttp... and now this).

But now I am ready to move all these changes over to my production machine and finally release a new version of my app using 7.30.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
The value x in scvSetup.Initialize(x) must be higher than 0.
It works OK even with scvSetup.Initialize(1).
You may also look at the Anchors feature in the layout, which will reduce drastically your DesignerScript.
You don't need to set the Left and Width properties anymore.
 
Upvote 0
Top