iOS Question How to achieve a blocking msgbox?

Mashiane

Expert
Licensed User
Longtime User
Hi there

I need a user to confirm an action with a Yes/No and subsequent processes should happen after the button click, depending on whether a yes or a no is selected.

Can someone please advise if there is a way around this? This is just my example, it works but does not wait..

B4X:
Sub Confirm(sEvent As String, sTitle As String, sMessage As String)
    Msgbox2(sEvent, sMessage, sTitle, Array As String("Yes", "No"))
End Sub

Sub btnDelete_Click
    Dim btn As ImageView
    btn = Sender
'msa.with(mst.pulse).duration(500).playon(btn)
    jobMap = CurrentComment
    media_id = jobMap.Get("media_id")
    day_comment_id = jobMap.Get("day_comment_id")
    ' confirm from the user
    Confirm("DeleteComment_Click","Delete Comment", "Are you sure that you want to delete this comment?")
   
End Sub

' code to use for confirm
Private Sub DeleteComment_Click(ButtonText As String)
    ' your code
    Select Case ButtonText.tolowercase
    Case "yes"
        'ProgressDialogShow2("Loading, please wait...",False)
        modMashiane.showspinner(hd)
        dbAction.Initialize
        dbAction.Put("action", "delete")
        dbAction.Put("day_comment_id",  day_comment_id)
        dbAction.Put("media_id", media_id)
        modMashiane.ExecutePHP(Me,dbAction, "delete", "comments.php", media_id)
    Case "no"
    End Select
End Sub
 

JanPRO

Well-Known Member
Licensed User
Longtime User
Hi,
but does not wait..
What do you mean by that?

Your code does exactly what you want:
need a user to confirm an action with a Yes/No and subsequent processes should happen after the button click, depending on whether a yes or a no is selected.

Or not? Please correct me if I have understood you wrong.

Jan
 
Upvote 0

karld

Active Member
Licensed User
Longtime User
I load a page with my yes no buttons on it and hide averything else.
Once they choose yes or no I un-hide the other page(s) and process based on the button click...

It works for me.
 
Upvote 0
Top