I have the following piece of code in a sub in one of my apps:
The If part (the call to "setAlert") works fine every time, however the Else part (the call to "cancelAlert") doesn't work in either release or debug mode - unless I step through the code line by line. If I change the code to:
it works fine every time.
I am using B4A v8.10 BETA #0 - so not sure if it's related to that or whether it happens on older versions as well. Obviously the pause created by stepping through the code is helping, but I'm not sure why it fails when the If Else is inline.
- Colin.
B4X:
'cDlg is a Custom Dialog
cDlg.ShowAsync(mName.Trim, "Close", "", alertText, LoadBitmap(File.DirAssets, "ic_info_outline_black_24dp.png"), True)
cDlg.SetSize(100%x, 405dip)
Wait For Dialog_Ready(pnl As Panel)
pnl.LoadLayout("popup")
Wait For Dialog_Result(res As Int)
If res = DialogResponse.NEGATIVE Then
If alertText = "Set Alert" Then CallSub3(Starter, "setAlert", mIndex, mTimeLeft * 1000) Else CallSub2(Starter, "cancelAlert", mIndex)
End If
The If part (the call to "setAlert") works fine every time, however the Else part (the call to "cancelAlert") doesn't work in either release or debug mode - unless I step through the code line by line. If I change the code to:
B4X:
'cDlg is a Custom Dialog
cDlg.ShowAsync(mName.Trim, "Close", "", alertText, LoadBitmap(File.DirAssets, "ic_info_outline_black_24dp.png"), True)
cDlg.SetSize(100%x, 405dip)
Wait For Dialog_Ready(pnl As Panel)
pnl.LoadLayout("popup")
Wait For Dialog_Result(res As Int)
If res = DialogResponse.NEGATIVE Then
If alertText = "Set Alert" Then
CallSub3(Starter, "setAlert", mIndex, mTimeLeft * 1000)
Else
CallSub2(Starter, "cancelAlert", mIndex)
End If
End If
it works fine every time.
I am using B4A v8.10 BETA #0 - so not sure if it's related to that or whether it happens on older versions as well. Obviously the pause created by stepping through the code is helping, but I'm not sure why it fails when the If Else is inline.
- Colin.
Last edited: