B4J Question How to insert a separator in B4J MenuBar [solved]

Discussion in 'B4J Questions' started by Didier9, Jun 11, 2019.

  1. Didier9

    Didier9 Active Member Licensed User

    in this post: https://www.b4x.com/android/forum/threads/designer-menu-items.56602/#content Erel indicates
    I have not managed to make this work. Tried this:
    Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Dim mb As MenuBar
    End Sub ' Process_Globals

    Sub AppStart( Form1 As Form, Args() As String )
        MainForm = Form1
    "Main" ) 'Load the layout file.
    "" )
        MainForm.RootPane.AddNode( mb, 
    00, -1, -1 )

    ' Add Settings menu to menu bar
        Dim SettingsMenu As Menu
    "Settings""" )
        mb.Menus.Add( SettingsMenu )
    ' Add Serial Ports submenu to Settings menu
        Dim SerialPort As Menu
    "Ports""" )
        SettingsMenu.MenuItems.Add( SerialPort )
    ' add Baud Rates
        Dim mnBaudrates As Menu
    "Baudrates""" )
        SettingsMenu.MenuItems.Add( mnBaudrates )
    ' add separator
        Dim s As String = "-"
        SettingsMenu.MenuItems.Add( s )
    ' add COM TimeOut
        Dim m As MenuItem
    "COM Time Out""mCOMTimeOut" )
        SettingsMenu.MenuItems.Add( m )

    End Sub
    which crashes, and this (with varying number of -):
    ' add separator
        Dim m As MenuItem
    "-""" )
        SettingsMenu.MenuItems.Add( m )
    which does not crash but does not produce a normal separator.

    Could I have an example of what to insert into the menu structure to create a separator?
  2. Daestrum

    Daestrum Well-Known Member Licensed User

    Dim s As JavaObject
     SettingsMenu.MenuItems.Add( s )
    Didier9 likes this.
  3. Didier9

    Didier9 Active Member Licensed User

    Thank you!
  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