Bug? Variable containing underscores don't call events

jmon

Well-Known Member
Licensed User
Longtime User
Hello,

I noticed something. When my a variable contains an underscore, events won't be called anymore, like in this example:
B4X:
Sub Process_Globals
    Private fx As JFX
    Private Main_Form As Form
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    Main_Form = Form1
    Main_Form.RootPane.LoadLayout("Main") 'Load the layout file.
    Main_Form.Show
End Sub

Sub Main_Form_CloseRequest (EventData As Event)
    Log("Close request")
End Sub

Sub Main_Form_Closed
    Log("Closed")
End Sub

Sub Main_Form_FocusChanged (HasFocus As Boolean)
    Log("Focus Changed: " & HasFocus)
End Sub

Sub Main_Form_IconifiedChanged (Iconified As Boolean)
    Log("Iconified Changed: " & Iconified)
End Sub

Thanks for your work. I really love B4J.

Regards
Jmon
 

Attachments

  • PrivateFormEventsNotCalled.zip
    1.4 KB · Views: 248

Erel

B4X founder
Staff member
Licensed User
Longtime User
There is no bug here. The variable name is not important. The "event name" property of the main form is always MainForm.

See this small test:
B4X:
Sub AppStart (Form1 As Form, Args() As String)
   Main_Form = Form1
   Main_Form.RootPane.LoadLayout("Main") 'Load the layout file.
   Main_Form.Show
   Dim b As Button
   b.Initialize("b_b")
   Main_Form.RootPane.AddNode(b, 0, 0, 100, 100)
End Sub

Sub b_b_Action
   Log("dd")
End Sub
 
Top