B4J Question [SOLVED] B4J CallSub issue in Release

techknight

Well-Known Member
Licensed User
Longtime User
In release mode, my CallSub in the Case Else does not work at all. Not even CallSubDelayed. If I compile and run in debug mode, it works fine.

Why? Here is the code:
B4X:
Sub myCanvas_ObjectDown(objectID As String)
    If Buttonpressed = True Then Return
    Buttonpressed = True
    Dim myCanvas As ABMCanvas = page.Component("myCanvas")
    Select Case objectID
        Case "mnupower"
            If EngineMS05.Connected = False Then
                page.Pause
                CallSub2(EngineMS05, "Connect", Me)
            Else
                CallSub(EngineMS05, "Disconnect")
            End If
        Case "mnucleargame"
            page.Msgbox2("ConfirmClearGame","Are you sure you wish to clear the game?","Clear Game","YES","NO",False,ABM.MSGBOX_TYPE_QUESTION,False,ABM.MSGBOX_POS_CENTER_CENTER,"")
        Case "mnusetclock"
            If EngineShared.ClockStopped = True Then SetClock
        Case "mnurefresh"
            page.Refresh
        Case "cmdstartstopclock"
            CallSub2(EngineShared,"cmdStartStopClock",Me)        
        Case Else
            Log("Trapped here") 'Works regardless whether in release or debug mode.
            CallSub(EngineShared,objectID) 'This doesnt work in release. Only in debug. WHY?
    End Select
    Sleep(150)
    Buttonpressed = False
    myCanvas.Refresh
    'Log("ObjectD: " & objectID)
End Sub
 
Top