B4A Class [B4X] [XUI] AS BottomMenu

wizard699

Active Member
Licensed User
Longtime 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.
 

jimmyF

Active Member
Licensed User
Longtime User
Here's what I am doing:
B4X:
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 String) As 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.
 

JMB

Active Member
Licensed User
Longtime 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:
B4X:
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
 

JMB

Active Member
Licensed User
Longtime 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:

JMB

Active Member
Licensed User
Longtime 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
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…