imgsimonebiliato Well-Known Member Licensed User Longtime User Mar 23, 2017 #1 Hello, i use an msgbox2 to interact with the user. I save the int value returned into a variable, that assume differents value, as you can see: Code: Copy Dim m As Int m = Msgbox2 ( "Message", "Title", "YES", "MAYBE", "NOT", NULL ); If m = DialogResponse.NEGATIVE Then Return (m = -2) If m = DialogResponse.POSITIVE Then (m = -1) .... end if If m = DialogResponse.CANCEL Then (m = -3) .... end if But, if I tap OUTSIDE the Msgbox2, I have a result that is "-3". How do I have a null result, or something like "0"?
Hello, i use an msgbox2 to interact with the user. I save the int value returned into a variable, that assume differents value, as you can see: Code: Copy Dim m As Int m = Msgbox2 ( "Message", "Title", "YES", "MAYBE", "NOT", NULL ); If m = DialogResponse.NEGATIVE Then Return (m = -2) If m = DialogResponse.POSITIVE Then (m = -1) .... end if If m = DialogResponse.CANCEL Then (m = -3) .... end if But, if I tap OUTSIDE the Msgbox2, I have a result that is "-3". How do I have a null result, or something like "0"?
imgsimonebiliato Well-Known Member Licensed User Longtime User Mar 23, 2017 #2 AndOrNot said: You don't need to return the value if m = dialogresponse.*, DialogResponse is already an int value. You can write a small sub like this if want to get 0 if an user presses outside the msgbox, but remember that press outside and press cancel are the same case Code: Copy Dim i As Int = ReturnValue Sub ReturnValue As Int Dim i As Int = Msgbox2("ok","nice","yes","cancel","neg",Null) If i = -3 Then Return 0 Return i End Sub Click to expand... As you can see above, I use all 3 buttons to do some action afterwards. So, I need to get a different value Upvote 0
AndOrNot said: You don't need to return the value if m = dialogresponse.*, DialogResponse is already an int value. You can write a small sub like this if want to get 0 if an user presses outside the msgbox, but remember that press outside and press cancel are the same case Code: Copy Dim i As Int = ReturnValue Sub ReturnValue As Int Dim i As Int = Msgbox2("ok","nice","yes","cancel","neg",Null) If i = -3 Then Return 0 Return i End Sub Click to expand... As you can see above, I use all 3 buttons to do some action afterwards. So, I need to get a different value
DonManfred Expert Licensed User Longtime User Mar 23, 2017 #3 The result is different for each of the buttons. See docu https://www.b4x.com/android/help/constants.html#dialogresponse Upvote 0
The result is different for each of the buttons. See docu https://www.b4x.com/android/help/constants.html#dialogresponse
imgsimonebiliato Well-Known Member Licensed User Longtime User Mar 23, 2017 #4 DonManfred said: The result is different for each of the buttons. See docu https://www.b4x.com/android/help/constants.html#dialogresponse Click to expand... I know that it is different, but if I press "CANCEL" is the same as presso outside. Upvote 0
DonManfred said: The result is different for each of the buttons. See docu https://www.b4x.com/android/help/constants.html#dialogresponse Click to expand... I know that it is different, but if I press "CANCEL" is the same as presso outside.