I am trying to reissue a custom dialog if the user does not fill in all of the options but on the second time around it blows past the wait and goes to the line where database gets initialized. After doing some reading I tried the dialog close and setting the response to null but cannot get it to work. Does anyone have any suggestions?
B4X:
Sub NewGame
Dialog.PutAtTop = True
Dialog.Title = csMsgTitle
Dim p As B4XView = xui.CreatePanel("")
p.SetLayoutAnimated(0, 0, 0, 451dip, 440dip)
p.LoadLayout("GameType")
Dim rsp As ResumableSub = Dialog.ShowCustom(p, "Done", "", "")
Log(rsp.Completed)
Dim btnDone As B4XView = Dialog.GetButton(xui.DialogResponse_Positive)
btnDone.SetBitmap(bmpBtnUp)
AnimateDialog(Dialog, "bottom")
Wait For (rsp) Complete (Result As Int)
Log(rsp.Completed)
If Result = xui.DialogResponse_Positive Then
Log("Army: " & strArmy & ", Size: " & strSize & ", Type: " & strType)
If strArmy = "" Or strSize = "" Or strType = "" Then
Dialog.Close(xui.DialogResponse_Positive)
Dialog.Close(xui.DialogResponse_Negative)
Dialog.Close(xui.DialogResponse_Cancel)
Dialog.Close(Result)
rsp = Null
SendMsg(Error, "Not all options have been selected")
NewGame
End If
End If
' Initalize Database
sqlGameDB.Initialize(strGamesPath, strGameName, True)