This class will allow you to create customized modal multicolored menus, you can change the color of the background, transparency, textsize, textcolor, add bitmaps to the background, add customized lines (or not), etc...
Requirements:
- B4A 2.xx
- Animation Lib
- AnimationPlus Lib
(AHlocale for the months demo)
- Add the Class module mbMenu.bas" to your project
How to use:
Initialize the class like this for example:
then create your custom menu :
At this time the menu is initialized and hidden at the bottom.
You just have to call it from "Sub Activity_KeyPress" (or any button on the screen)
and get the return parameter with this routine
The examples are documented for a nice handling.
You can of course customize the animations too.
This is my first post. Have fun !
Requirements:
- B4A 2.xx
- Animation Lib
- AnimationPlus Lib
(AHlocale for the months demo)
- Add the Class module mbMenu.bas" to your project
How to use:
Initialize the class like this for example:
B4X:
Sub Globals
Dim Menu As mbMenu
End Sub
then create your custom menu :
B4X:
' Directions in
' 0 : Bottom -> Top
' 1 : Left -> Right
' 2 : Right -> Left
' Directions out
' 3 : Top -> Bottom
' 4 : Left -> Right
' 5 : Right -> Left
' Activity, Module, EventName,ColCount, MinBtnSize,ItemsNbr,Width, Corner, Color, Direction In , Direction Out
Menu.Initialize(Activity,Me,"Menu_Click", 3,80dip, 3, 100%x, 0, Colors.ARGB(200,30,30,30),0,3)
'Text, Image, BackColor, TextSize, TextColor, ReturnValue
Menu.AddItem("Smile",LoadBitmap(File.DirAssets, "emotion_smile_icon&32.png"),Colors.ARGB(0,0,0,0),14,Colors.White,0)
Menu.AddItem("Preferences",LoadBitmap(File.DirAssets, "cogs_icon&32.png"),Colors.ARGB(0,0,0,0),14,Colors.White,1)
Menu.AddItem("Search",LoadBitmap(File.DirAssets, "globe_3_icon&32.png"),Colors.ARGB(0,0,0,0),14,Colors.White,2)
' LinesOnOff, LinesColor,LinesStroke
Menu.Dispatch_Menus(True,Colors.ARGB(80,255,255,255),1)
At this time the menu is initialized and hidden at the bottom.
You just have to call it from "Sub Activity_KeyPress" (or any button on the screen)
B4X:
Menu.Show
and get the return parameter with this routine
B4X:
Sub Menu_Click(mbButton As Int)
Menu.Hide
ToastMessageShow ("Clicked on Button " & mbButton, False)
End Sub
The examples are documented for a nice handling.
You can of course customize the animations too.
This is my first post. Have fun !
Attachments
Last edited: