B4J Question MenuItem problem ...

Waldemar Lima

Well-Known Member
Licensed User
i would like get menubar item text , to create those events ... but when i call gerente_menubar_Action , nothing is returned ... someone know how can i do it ?


code below :
B4X:
#Region Project Attributes 
    #MainFormWidth: 330
    #MainFormHeight: 420
#End Region
#AdditionalJar: mysql-connector-java-5.1.46-bin.jar

Sub Process_Globals
    Public fx As JFX
    Private MainForm As Form
    Private GerenteForm As Form
   
    'Global declares
   
   
    'login declares
    Private LogoImage_Login As ImageView
    Private login_label_email As Label
    Private login_label_senha As Label
    Private login_email As TextField
    Private login_senha As TextField
    Private login_button As Button
   
    'mana declares
   
    Private gerente_webview As WebView
    Private gerente_menubar As MenuBar
End Sub

Sub AppStart (Form1 As Form, Args() As String)
   
    Log(MySQL.Connect("helloWorld","mydbuser","M1DBP455"))
   
    MainForm = Form1
    MainForm.WindowWidth = 330
    MainForm.WindowHeight = 420
    MainForm.Resizable = False
    MainForm.RootPane.LoadLayout("login") 'Load the layout file.
    MainForm.Show

    Log(MainForm.RootPane.NumberOfNodes)
   
End Sub

Sub login_button_Click
   
    If (login_email.Text <> "") And (login_senha.Text <> "") Then
           
        If (MySQL.EfetuarLogin(login_email.Text,login_senha.Text) = "SucessFull") Then
            MainForm.RootPane.RemoveAllNodes
            MainForm.WindowWidth = 600
            MainForm.WindowHeight = 600
            MainForm.RootPane.LoadLayout("other")
            'GerenteForm.Show
            gerente_webview.LoadUrl("https://www.lipsum.com/")
           
        Else
            fx.Msgbox(MainForm,"Incorrect Details","Login Error !")
        End If   
       
    End If
   
End Sub

'#############################################################
'#############################################################
'############################################################
' HERE IS PROBLEM !!! DONT RETURNS NOTHING ....
Sub gerente_menubar_Action
    Dim mi As MenuItem = Sender
    Log(mi.Text)
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
 
Top