B4A Class [B4X] [XUI] AS BottomMenu

Discussion in 'Additional libraries, classes and official updates' started by Alexander Stolte, Aug 16, 2018.

  1. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

     
  2. wizard699

    wizard699 Active Member Licensed User

    Hi Alexander. Actually I was referring to the unselected icons. But I decided to implement an evolution. Wanting to have the freedom to put the bar of any color and the icons also colored, I introduced a new property in the Designer, OriginalIconColor. If enabled it allows you to keep in the original icons ... otherwise they become white. I hope you do not mind if I have customized your great component.
    And if anyone wants, I can release the modified version here ... but I would not want to overlap your great work and any versions you were already working on.
     
  3. jimmyF

    jimmyF Active Member Licensed User

    Here's what I am doing:
    Code:
    Dim b As Bitmap = Utils.TextToBitmap(Chr(0xF104),72,Colors.White,45,45,Typeface.FONTAWESOME,"CENTER")
        asBM.SetIcon2(b)

    Sub TextToBitmap(s As String, FontSize As Float, lFontColour As Long, iWidth As Int, iHeight As Int, TF As Typeface, strAlignment As StringAs Bitmap
        
    Dim bmp As Bitmap
        
    Dim cvs As Canvas
     
        bmp.InitializeMutable(iWidth * 
    100dip / 100, iHeight * 100dip / 100)
        cvs.Initialize2(bmp)
        
    Dim h As Double = cvs.MeasureStringHeight(s, TF, FontSize)
        cvs.DrawText(s, bmp.Width / 
    2, bmp.Height / 2 + h / 2, TF, FontSize, lFontColour, strAlignment)
     
        
    Return cvs.Bitmap

    End Sub
    This way you can change the icon colour on the fly anytime you wish.
     
    wizard699 likes this.
  4. larprogramer

    larprogramer Member Licensed User

    hi can you tell me.how to hide button here.
     

    Attached Files:

  5. JMB

    JMB Active Member Licensed User

    Hi there.

    I downloaded the B4A example at the beginning of this thread and updated the AsBottomMenu.bas file to version 1.6 and ran the same example.

    It immediately crashed so I went into the designer and switched on text and Show Middle button.

    That allowed the example to run, but when I tap the second icon along, it crashes in the function inside AsBottomMenu.bas:
    Code:
    Private Sub ChangeColorBasedOnAlphaLevel(bmp As B4XBitmap, NewColor As Int) As B4XBitmap
    Having put a Log(bmp.IsInitialized) line in the Sub listed above, it appears that the bmp being passed to this sub has not been initialised, although it is when the application first runs.

    Can anyone shed some light on this?

    Thanks,

    JMB
     
  6. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

    This makes no sense, Because, if you enable Text instead of Icons then is this:
    Not needed
     
  7. Alexander Stolte

    Alexander Stolte Well-Known Member Licensed User

     
  8. larprogramer

    larprogramer Member Licensed User

    Thanks you
     
  9. JMB

    JMB Active Member Licensed User

    Hi Alexander, thanks for your reply.

    I think I am using this view incorrectly so I shall read the other entries in the forum properly first!

    JMB
     
    Last edited: Feb 3, 2019
  10. JMB

    JMB Active Member Licensed User

    Hi Alexander, I am trying to figure out how to get rid of the gap that is left above the separator line when one uses the middle button as a page rather than a big button.

    Would it be possible to give some guidance as to how to get rid of the gap where the number 5 button is?

    Thank you.

    JMB
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice