UI5 Messagebox synchron
<p>Hi i implemented a Messagebox in a for loop, but i know the messagebox works asynchron. 
I want that the programm wait for every loop to the desicion of the user. </p>

<pre><code>onBook: function(oEvent) {
  var that = this;
  for (var i = 0; i &lt; Items.length; i++){

      function message(innerArg) {
        sap.m.MessageBox.confirm(
                "Text", {
                  icon : sap.m.MessageBox.Icon.INFORMATION,
                  title : "Really",
                  actions : [ sap.m.MessageBox.Action.YES,
                      sap.m.MessageBox.Action.NO ],
                  onClose : function(oAction) {
                    if (oAction === sap.m.MessageBox.Action.NO) {
                     delete(i);
                    }else{

                    }
                  }
                });
        }

        message(i);

  }
 that.do(oEvent); 
</code></pre>

<p>The programm jumps in the "do" method before a user action is done </p>

<p>Edit: </p>

<pre><code>      for (var i = 0; i &lt; Items.length; i++){

      (function (innerArg) {
        sap.m.MessageBox.confirm(
                "Delete?", {
                  icon : sap.m.MessageBox.Icon.INFORMATION,
                  title : "Delete",
                  actions : [ sap.m.MessageBox.Action.YES,
                      sap.m.MessageBox.Action.NO ],
                  onClose : function(oAction) {
                    if (oAction === sap.m.MessageBox.Action.NO) {
                     delete(innerArg)
                  }}
                });
        })(i);   

  }
 that.Save(oEvent);
</code></pre>

<p>When the box is open the entries are booked because the programm goes to the save method without wating of user action Whats wrong ? </p>