iOS Question (solved) AS Popup Menu: Display problem at first call

fredo

Well-Known Member
Licensed User
Longtime User
The AS Popup Menu is an enrichment of the B4X Views and basically easy to use.

And although it works fine in B4A, a strange effect occurs in B4i:

24-02-_2022_06-16-36.jpg

At the first call the list is narrow, at all further calls it is normal wide.

This code was transferred by copy/paste from an Android project:
B4X:
    'aspm_main.Initialize(Activity, Me, "aspm_main") ' <-- works in B4A
    
    aspm_main.Initialize( Page1.RootPanel, Me, "aspm_main")
    aspm_main.ActivityHasActionBar = True
    aspm_main.OrientationVertical = aspm_main.OrientationVertical_BOTTOM
    aspm_main.DividerEnabled = True
    aspm_main.DividerHeight = 2dip
    aspm_main.DividerColor = Starter.xui.Color_White
    aspm_main.TitleLabelProperties.BackgroundColor = Starter.xui.Color_White
    aspm_main.TitleLabelProperties.TextColor = Starter.xui.Color_Black
    aspm_main.TitleLabelProperties.Height = 20dip
    aspm_main.ItemLabelProperties.xFont=Starter.XUI.CreateDefaultFont(12)
    aspm_main.AddTitle(Starter.loc.Localize("Musikempfehlung"),60dip)
    aspm_main.MenuCornerRadius = 4dip
    For i = 0 To musiList.Size -1
        aspm_main.AddMenuItem(musiList.Get(i), i)
    Next
    aspm_main.OpenMenu(C1Panel_Toolbar, 96%x)
    wait for aspm_main_ItemClicked(Index As Int,Tag As Object)

Does anyone have a suggestion on where to start troubleshooting?
 

ilan

Expert
Licensed User
Longtime User
Does anyone have a suggestion on where to start troubleshooting?
it looks like you load the layout before the page resize event has been called. in that stage, the app does not know the screen size only after the resize event has been called, the app knows the correct size.
 
Upvote 1

fredo

Well-Known Member
Licensed User
Longtime User
...before the page resize event...
Good idea to consider that first.

But
B4X:
Log(Page1.RootPanel.Width)
right before aspm_main.initialize(..) returns 375.
That seems to be a legit value.

But more interestingly...
B4X:
Log(aspm_main.Base.Width)
right before aspm_main.OpenMenu(..) returns 0

Even
B4X:
aspm_main.Resize(Page1.RootPanel.Width, Page1.RootPanel.Height)
right before aspm_main.OpenMenu(..) didn't fixed it.

Also
B4X:
aspm_main.Base.SetLayoutAnimated(..)
didn't change the effect.

Am I missing something?
 
Upvote 0
Top