iOS Question [AS_DraggableBottomCard] Card not shown

yiankos1

Well-Known Member
Licensed User
Longtime User
Hello,

Third post in a row about porting b4a to b4i (i hope it will be the last).

I create a draggable bottom card with this code:
B4X:
Sub B4XPage_Resize (Width As Int, Height As Int)

    Dim r As Rect = B4XPages.GetNativeParent(Me).SafeAreaInsets
    r.Top = Max(20, r.Top)
    Root.SetLayoutAnimated(0, r.Left, r.Top, Width - r.Right - r.Left, Height - r.Bottom - r.Top)
    If Root.NumberOfViews = 0 Then CreateLayout
 
End Sub

Sub CreateLayout As ResumableSub
 
    Root.LoadLayout("scoreboard")
 
    PCLV.Initialize(Me, "PCLV", clvScoreboard)
 
    clvScoreboard.Asview.Color = xui.Color_Transparent
    clvScoreboard.GetBase.Height = Root.Height + Root.Top - pnlToolbar.Height
    btnFilters.CustomLabel.Font = Font.CreateNew2("materialdesignicons",24)
 
    btMenu.Initialize(Me,"btMenu")
    btMenu.Create(Root,200,200,50,Root.Width,btMenu.Orientation_MIDDLE)
    btMenu.HeaderPanel.LoadLayout("btMenuHeader")
    btMenu.BodyPanel.LoadLayout("btMenuFilterScores")
    btMenu.CornerRadius_Header = btMenu.HeaderPanel.Height/2

 
    lblTitleHeader.Text = "Φίλτρα"
 
    'stSex is ASSegmentedTab
    stSex.AddTab2("Γυναίκα",Null,0)
    stSex.AddTab2("Άνδρας",Null,1)
    stSex.AddTab2("Άλλο",Null,2)
 
 
    stSex.SelectedIndex(B4XPages.MainPage.user.sex,0)

    'stRx is ASSegmentedTab
    stRx.AddTab2("Rx",Null,1)
    stRx.AddTab2("Scaled",Null,0)
     
    Return Null
End Sub

When i want to show:
B4X:
Private Sub btnFilters_Click
    btMenu.Show(False)
End Sub

nothing is shown. But, this sub fires normally:
B4X:
Sub btMenu_Open
    log("ok")
End Sub

If I put at creation code a breakpoint and go step by step, then everything working fine!

1.png


After creation sub, I am just fetching scores from server in order to put them in a clv.

Thank you for your time.
 

Alexander Stolte

Expert
Licensed User
Longtime User
Sorry, but without an example project that shows the error, i can't help you, i lack too much context.

If I put at creation code a breakpoint and go step by step, then everything working fine!
MAybe a Sleep(0) is the solution.
 
Upvote 1
Solution

yiankos1

Well-Known Member
Licensed User
Longtime User
Sorry, but without an example project that shows the error, i can't help you, i lack too much context.


MAybe a Sleep(0) is the solution.
A single sleep did not do the trick! But this one, DID!
B4X:
    btMenu.Initialize(Me,"btMenu")
    Sleep(0)
    btMenu.Create(Root,200,200,50,Root.Width,btMenu.Orientation_MIDDLE)
    Sleep(0)
    btMenu.HeaderPanel.LoadLayout("btMenuHeader")
    Sleep(0)
    btMenu.BodyPanel.LoadLayout("btMenuFilterScores")
    Sleep(0)
    btMenu.CornerRadius_Header = btMenu.HeaderPanel.Height/2
    Sleep(0)

I know it's not a good practice, but if it's working then don't touch it!

Thanks again Alex.
 
Upvote 0
Top