Bug? Portrait and Landscape variables always false in abstract designer

corwin42

Expert
Licensed User
Longtime User
If I use the Portrait or Landscape variables in a designer script, they are always false in the abstract designer. It doesn't matter if I choose a Portrait or Landscape variant in abstract designer (in script mode). In the app the script works well. The problem is only in the abstract designer.

I think this worked in previous versions.
 

LucaMs

Expert
Licensed User
Longtime User
I don't see this error. How do you tested it? Are you sure that the Abstract Designer was in Script Mode?

B4X:
If Landscape Then
    Button1.Left = 0
Else If Portrait Then
    Button1.HorizontalCenter = 50%x
End If

DesScript.gif
 
Last edited:

corwin42

Expert
Licensed User
Longtime User
Ah, seems to be a bit more complicated to reproduce. Maybe it has something to do with nesting IFs or ActivitySize call.

Assume the following designer script:

B4X:
If ActivitySize > 7.5 Then
    Panel.HorizontalCenter = 50%x
    Panel.VerticalCenter = 50%y
Else
    Panel.Top = 0
    If Portrait Then
        Panel.Left = 0
    Else
        Panel.Right = 100%x
    End If
End If

If device size is bigger than 7.5 inch (like 10" tablet preset) then the panel is centered correctly.
If device size is smaller then the panel is displayed always on the right top edge regardless of portrait or landscape mode and this is wrong.

If I remove the outer IF everything seems to be fine.

Layoutfile attached
 

Attachments

  • laynew.bal
    1.4 KB · Views: 213
Last edited:

corwin42

Expert
Licensed User
Longtime User
Sorry, but shouldn't ActivitySize "work" only at run-time? How the Designer can know the Activity Size before the layout is loaded?
No, the abstract designer has some presets with many different device sizes.
 

corwin42

Expert
Licensed User
Longtime User
Bump.

@Erel:
Maybe you have missed my post #4 now. I guess this is a somewhat strange bug. Hopefully you can reproduce it with the layout file.
 
Top