[B4X] [XUI] AS Bottom Menu V2

itgirl

Active Member
Licensed User
Longtime User
Amazing class thanks, i just found a little bug if you enable EnableMiddleButtonAsTab and you click on already active tab the underline get little messy the solution i found is in underline_slide_animation_withtext_2

B4X:
        If enable_middlebutton_astab = True Then
            Dim tmp As Double = xpnl_underline.Left - totab.Left  - 40dip/4
        Else
            Dim tmp As Double = xpnl_underline.Left - totab.Left  - 40dip/2
        End If
amazing work with calculations by the way ;)
 

TILogistic

Expert
Licensed User
Longtime User
if you want to see the halo effect on the middle button

B4X:
Private Sub Middle_Button_Click_Handler
    If xui.SubExists(mCallBack, mEventName & "_MiddleButtonClick",0) Then
        CallSub(mCallBack, mEventName & "_MiddleButtonClick")
    End If
    RippleEffect(PanelMiddlebutton, Ripple_Effect_Color, 250)
End Sub

B4X:
'https://www.b4x.com/android/forum/threads/b4x-xui-simple-halo-animation.80267/#content
Private Sub RippleEffect (Parent As B4XView, Color As Int, Duration As Int)
    Dim cvs As B4XCanvas
    Dim p As B4XView = xui.CreatePanel("")
    Dim InnerRadius As Int = Parent.Height * 1.30
    If Parent.Width <> Parent.Height Then InnerRadius = Max(Parent.Width, Parent.Height) * 1.60
    p.SetLayoutAnimated(0, 0, 0, InnerRadius, InnerRadius)
    cvs.Initialize(p)
    cvs.DrawCircle(cvs.TargetRect.CenterX, cvs.TargetRect.CenterY, cvs.TargetRect.Width / 2, Color, True, 0)
    Dim bmp As B4XBitmap = cvs.CreateBitmap
    p.RemoveViewFromParent
    Dim iv As ImageView
    iv.Initialize("")
    Dim p As B4XView = iv
    Dim Radius As Int = InnerRadius/2
    Dim x As Int = Parent.Width/2
    Dim y As Int = Parent.Height/2
    p.SetBitmap(bmp)
    Parent.AddView(p, x, y, 0, 0)
    p.SetLayoutAnimated(Duration, x - Radius, y - Radius, Radius * 2, Radius * 2)
    p.SetVisibleAnimated(Duration, False)
    Sleep(Duration)
    p.RemoveViewFromParent
End Sub
 

AllanH

Member
Licensed User
Longtime User
Great bottom tab

However, changing the current tab in code does not change the current tab visually.
I've amended the code below to call the relevant click but this is a bit untidy and could probably be better written.


B4X:
Public Sub setCurrentTab(tabnumber As Int)
  
    If tabnumber = 1 Or tabnumber = 2 Or tabnumber = 3 Or tabnumber = 4 Or tabnumber = 5 Then
      
        If current_tab <> tabnumber Then
          current_tab = tabnumber
      
      'extra code below:
      Select tabnumber
          Case 1
                tab_1_Click   
          Case 2
                tab_2_Click
            Case 3
                tab_3_Click
            Case 4
              tab_4_Click     
            Case 5
                tab_5_Click
        End Select
        End If
      
        Else
          
            Log("Tab Number not in range")
      
    End If
  
End Sub
 

Alexander Stolte

Expert
Licensed User
Longtime User
I tried to use setMiddleButtonSize but have no effect
I see it, the issue is in the Base_Resize Sub, i fix it.
I add a private global variable for the middle button size, this should fix the issue.

Can you try it now? i cant test it with B4I, because my Apple Dev. account has expired for 2 months.

V2.5
  • Fix setMiddleButtonSize is not working
 

Kope

Active Member
Licensed User
hi Please the TabChange (CurrentTab as int) event is not responding in b4i

please any help?
 

Gabino A. de la Gala

Well-Known Member
Licensed User
Longtime User
I had problems with the SetCurrentTab and finally I solved it by modifying one of the procedures.

Here I leave it.

B4X:
Public Sub setCurrentTab(tabnumber As Int)
        Select Case tabnumber
            Case 1
                tab_1_handler(True,250,150)
                current_tab = tabnumber
            Case 2
                tab_2_handler(True,250,150)
                current_tab = tabnumber
            Case 3
                tab_3_handler(True,250,150)
                current_tab = tabnumber
            Case 4
                tab_4_handler(True,250,150)
                current_tab = tabnumber
            Case 5
                tab_5_handler(True,250,150)
                current_tab = tabnumber
            Case Else
                Log("Tab Number not in range")
        End Select
End Sub

I suppose that in later versions I can solve it in a more appropriate way.

A greeting.
 

Guenter Becker

Active Member
Licensed User
Hallo,
zuerst mal: gute Arbeit, Danke.
Dann ein paar Fragen mit der Bitte um Antwort:
- wie kann die Value Anzeige ausgeblendet werden?
- wie kann die Textanzeige aus/eingeblendet werden?
- Was nützt mir die Aufzählung zahlreicher Funktionen, wenn ich sie nicht aurufen kann?

Danke für die Arbeit, würde das View schon gerne verwenden aber die Beschreibung ist schon dürftig.
Viele Grüße Günter

P.S.
If it is neccessary to give my comment/questiones in English pleas inform me.
 

Alexander Stolte

Expert
Licensed User
Longtime User
wie kann die Value Anzeige ausgeblendet werden?
- wie kann die Textanzeige aus/eingeblendet werden?
ist das beides nicht das gleiche?
is not that the same?

Was nützt mir die Aufzählung zahlreicher Funktionen, wenn ich sie nicht aurufen kann?
Was soll das für eine Frage sein?
What's that for a question?
 

JMB

Active Member
Licensed User
Longtime User
Hi there.

I've just downloaded this and I get the following errors:

B4X:
Unknown member: underlineanimation
Unknown member: textvisible
Unknown member: textonly
Cannot access private member: middlebuttonvisible
Unknown member: middlebuttonastab
Unknown member: middlebuttonicon

Any clues as to why this may be?

Thanks,

JMB
 

JMB

Active Member
Licensed User
Longtime User
Hi Alexander, any clues as to what the problem may be?

Thanks.

JMB
 

JMB

Active Member
Licensed User
Longtime User
My apologies, Alexander. My mistake.

I thought the ASBottomMenu.bas file was part of the example. I downloaded that file and linked to it and now there are no problems.

Thanks for your patience.

JMB
 
Top