iOS Question msgbox

moore_it

Well-Known Member
Licensed User
Longtime User
How i do for create msgbox with yes/no selection ?

thanx in advice
Toni
 

ilan

Expert
Licensed User
Longtime User
B4X:
Sub Button1_Click
    Msgbox2("Msg","Info","Press yes to continiue",Array("yes","no"))
End Sub

Sub Msg_Click(ButtonText As String)

If ButtonText = "yes" Then
    Log("yes pressed")
Else If ButtonText = "no" Then
    Log("no pressed")
End If

End Sub
 
Upvote 0

moore_it

Well-Known Member
Licensed User
Longtime User
B4X:
Sub Button1_Click
    Msgbox2("Msg","Info","Press yes to continiue",Array("yes","no"))
End Sub

Sub Msg_Click(ButtonText As String)

If ButtonText = "yes" Then
    Log("yes pressed")
Else If ButtonText = "no" Then
    Log("no pressed")
End If

End Sub
Thanks very much
 
Upvote 0

moore_it

Well-Known Member
Licensed User
Longtime User
Hello ilan12041981,

in this way I need xxxx sub for each msgbox2 I call, there is another way to waiting the response of the user ?

Thanks again
 
Upvote 0

ilan

Expert
Licensed User
Longtime User
Hello ilan12041981,

in this way I need xxxx sub for each msgbox2 I call, there is another way to waiting the response of the user ?

Thanks again


no you dont need xxxx sub...
do it like this

B4X:
Sub Process_Globals
   dim dothis as int
End Sub

'......

Sub Button1_Click
    cmsg2("Button1 Title","Button1 performed a Msgbox",1)
End Sub

Sub Button2_Click
    cmsg2("Button2 Title","Button2 performed a Msgbox",2)
End Sub

Sub Button3_Click
    cmsg2("Button3 Title","Button3 performed a Msgbox",3)
End Sub

Sub Button4_Click
    cmsg2("Button4 Title","Button4 performed a Msgbox",4)
End Sub


Sub cmsg2(title as string, msgstr as string, action as int)
   dothis = action
   Msgbox2("Msg", title, msgstr, Array("yes","no"))
end sub

Sub Msg_Click(ButtonText As String)

If ButtonText = "yes" Then
    if dothis = 1 Then log("action1 - Button1_clicked")
    if dothis = 2 Then log("action2 - Button2_clicked")
    if dothis = 3 Then log("action3 - Button3_clicked")
    if dothis = 4 Then log("action4 - Button4_clicked")
Else If ButtonText = "no" Then
    Log("no pressed")
End If

End Sub
 
Upvote 0
Top