B4J Question Code works in Release mode but not Debug mode

chuck3e

Active Member
Licensed User
Longtime User
Am I missing something? The following code runs ok in Release mode but gets an error in DeBug.

The error is :
Error occurred on line: 14 (debugtest).
java.lang.RuntimeException: Object should first be initialized (Button).

The panels referenced have just one button each. Clicking the button in the calling module works calling the second module but the called module screen flashes briefly then gets the error.

Here is my complete code.

Calling code module:
B4X:
Sub Process_Globals
    Private fx As JFX
    Public MainForm As Form
End Sub

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

Sub Button01_MouseClicked (EventData As MouseEvent)
    DeBugTest.Begin  'Call to second code module
End Sub

Called DeBugTest code module:
B4X:
Sub Process_Globals
    Private fx As JFX
    Dim MainForm2 As Form
    Dim Button0x  As Button
End Sub

Sub Begin
    MainForm2.Initialize("MainForm2", -1, -1)
    MainForm2.Rootpane.LoadLayout("DeBugTest") 'Load the layout file.
    MainForm2.BackColor = fx.Colors.magenta
    MainForm2.Show
    Button0x.text   = "   1. DeBug"  'This is line 14
    Button0x.tag   = 1
End Sub

Sub Button0x_MouseClicked (EventData As MouseEvent)
End Sub
 

chuck3e

Active Member
Licensed User
Longtime User
First time uploading zips. First time for everything.
 

Attachments

  • DeBugError.zip
    2.4 KB · Views: 218
Upvote 0
Top