B4J Library [B4X] [XUI] jSD BottoMenu (with source code)

Download from Here

iSD_BottoMenu

Author:
Star-Dust
Version: 1.6
  • BottoMenu
    • Events:
      • Selected (Value As Int)
    • Fields:
      • BackGroundColor As Int
      • Position As Int
        ' set or get Position
    • Functions:
      • AddMenu (CharText As String, FontName As B4XFont) As String
      • Class_Globals As String
      • Clear As String
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map) As String
        Base type must be Object
      • Initialize (Callback As Object, EventName As String) As String
      • Invalidate As String
      • IsInitialized As Boolean
        Verifica se l'oggetto sia stato inizializzato.
      • TransitionAnimated (Duration As Int, FromBmp As B4XBitmap, ToBmp As B4XBitmap, ImageView AsB4XView) As ResumableSub

upload_2019-2-23_9-0-23.png
 
Last edited:

Star-Dust

Expert
Licensed User
B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
    MainForm.Show
    
    BottoMenu1.AddMenu(Chr(0xF009),xui.CreateFontAwesome(18))
    BottoMenu1.AddMenu(Chr(0xF0CA),xui.CreateFontAwesome(18))
    BottoMenu1.AddMenu(Chr(0xF0EC),xui.CreateFontAwesome(18))
    BottoMenu1.AddMenu(Chr(0xF096),xui.CreateFontAwesome(18))
    BottoMenu1.AddMenu(Chr(0xF2C0),xui.CreateFontAwesome(18))
End Sub

'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

Sub BottoMenu1_Selected(Value As Int)
    Log(Value)
End Sub
 

Star-Dust

Expert
Licensed User
I had forgotten to attach the source. :p Sorry.

You can find it at post # 1
 

giannimaione

Well-Known Member
Licensed User
it usually does not work!
i click on botton icon bar, and it usually does not work.
then maximize/riseze form and it work
 

Star-Dust

Expert
Licensed User
it usually does not work!
i click on botton icon bar, and it usually does not work.
then maximize/riseze form and it work
I do not understand :p
 

RWK

Member
Licensed User
Hi,

he meant that sometimes the Click Event doesn't appear anymore.

B4X:
Private Sub Label_MouseClicked (EventData As MouseEvent)
    Dim B4XL As B4XView = Sender
    Dim I As Int = B4XL.Tag
    Dim Label_Width As Float = mBase.Width / ChrMenu.Size
    Dim W As Int=(I+0.5)*Label_Width-((ImageViewlSize+BorderSize)/2)
    Dim M As Map = ChrMenu.Get(I)
'Added
    Log("Pos: "& EventData.X& ":" & EventData.Y)
'-------
    Position=I
    Slct.SetLayoutAnimated(200,w,0,ImageViewlSize+BorderSize,ImageViewlSize+BorderSize)
    Sleep(200)
    Slct.RemoveAllViews
    Slct=GenerateViewSelected(M.Get("CharText"),xui.Color_Black,M.Get("Font"))
    mBase.AddView(Slct,w,0,ImageViewlSize+BorderSize,ImageViewlSize+BorderSize)
    
    If xui.SubExists(mCallBack,mEventName & "_Selected",1) Then CallSub2(mCallBack,mEventName & "_Selected",Position)
End Sub

After some Clicks on the Bar no more Label_MouseClicked Events occurs...
Sometime one arrive....sometimes I have to resize the windows to make it work for some clicks again.

Maybe this is somewhat more addressed to jXUI ? Don't know.

Grüße
Rainer
 

Star-Dust

Expert
Licensed User
There is an error in the code, Create a new panel with the selected option but do not delete the old one that remains in transparency that absorbs and consumes click events

Update the sub in this way (at post#1 I updated the example)
B4X:
Private Sub Label_MouseClicked (EventData As MouseEvent)
    Dim B4XL As B4XView = Sender
    Dim I As Int = B4XL.Tag
    Dim Label_Width As Float = mBase.Width / ChrMenu.Size
    Dim W As Int=(I+0.5)*Label_Width-((ImageViewlSize+BorderSize)/2)
    Dim M As Map = ChrMenu.Get(I)
  
    Position=I
    Slct.SetLayoutAnimated(200,w,0,ImageViewlSize+BorderSize,ImageViewlSize+BorderSize)
    Sleep(200)
    Slct.RemoveViewFromParent
    Slct.RemoveAllViews
    Slct=GenerateViewSelected(M.Get("CharText"),xui.Color_Black,M.Get("Font"))
    mBase.AddView(Slct,w,0,ImageViewlSize+BorderSize,ImageViewlSize+BorderSize)
  
    If xui.SubExists(mCallBack,mEventName & "_Selected",1) Then CallSub2(mCallBack,mEventName & "_Selected",Position)
End Sub
 
Last edited:

Star-Dust

Expert
Licensed User
Update code rel. 1.1
 

Star-Dust

Expert
Licensed User
update rel 1.3 (post#1)
 

Star-Dust

Expert
Licensed User
Update 1.41
  • Solved a bug in the animation. If another option is clicked while the animation has not yet finished, the click is ignored
 

Star-Dust

Expert
Licensed User
The library is now transferred, you can download it from Here
 

oparra

Well-Known Member
Licensed User
Hi, is it possible to create something like this purely in HTML for b4j webapp? Thanks.
You know that you can find these and other better ones on the web that are developed in javascripts and css,

Recognize this example:
 

Attachments

  • 1.gif
    1.gif
    188 KB · Views: 34

oparra

Well-Known Member
Licensed User
Nice; but how to use (apply) it in B4J?
easy to use with jserver, it's just javascritps and css


Just a couple of days ago I tried this and it doesn't work (more of a problem, I gave up immediately)
this is JFXtras / jfxtras-styles, they are css for JavaFX

sample: style metro

1627389923244.png


and I apologize for responding in this post.

If you want to know more, open a new post
 

oparra

Well-Known Member
Licensed User
b4j "client" (or stand-alone sw).
 

LucaMs

Expert
Licensed User
Top