B4J Tutorial [ABMaterial] TIP: ... and wait for

Maybe this is old news, but I was wondering if wait for could work with ABM events, and it seems they do!

Here for example (it is a page_ event, so I put it in the same class as where the page is defined), I ask the user with a message box if he is sure to do the delete. If yes, then do the queries.

B4X:
Sub CheckDoDelete(TableActiveID As Int)
   Dim Code As String = "REGISTRATION_DELETE"
   Dim authLoginID As String = page.ws.Session.GetAttribute2("authLoginID2020", "")
   Dim sysrlID As Int = DBMApp.InsertLog(authCurrentMasterID, TableActiveID, Code, authLoginID)
  
   page.Msgbox2("FLOW", "Ben je zeker?", "", "ja", "nee", False, ABM.MSGBOX_TYPE_NOICON, False, ABM.MSGBOX_POS_CENTER_CENTER, "onetwo")
   Wait For Page_MsgboxResult(returnName As String, result As String)
   If result = ABM.MSGBOX_RESULT_OK Then
       Dim reg As RecRegistration = DBMApp.RegistrationFromRecord(TableActiveID,BrowserTZ)
      
       Dim SQL As SQL = DBM.GetSQL
       Try
           SQL.BeginTransaction          
           Select Case reg.regRegTypID
               Case 16
                   DBMApp.UPDATESTATUSRegistration(SQL, TableActiveID, 18, Null, authLoginID, Code,sysrlID)
               Case 19
                   DBMApp.UPDATESTATUSRegistration(SQL, TableActiveID, 21, Null, authLoginID, Code,sysrlID)
               Case 26
                   DBMApp.UPDATESTATUSRegistration(SQL, TableActiveID, 28, Null, authLoginID, Code, sysrlID)
           End Select          
           SQL.TransactionSuccessful
          
           Table2.DoDelete
       Catch
           SQL.Rollback
       End Try      
       DBM.CloseSQL(SQL)
   End If
End Sub

Alain
 
Last edited:
Top