1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

B4J Question [ABMaterial] page.InputBox problem

Discussion in 'B4J Questions' started by magi6162, Dec 4, 2017.

  1. magi6162

    magi6162 Well-Known Member Licensed User

    acbMap is a ABMActionButton
    btnSalva is a SubMenu

    in clicked event a messagebox appears. An input box appears in the response to the messagebox, but nothing appears. (No error in log debugging)

    page.InputBox does not run:(


    Code:
    Sub acbMap_Clicked(Target As String, SubTarget As String)
        
    If SubTarget="" Then
            
    Log("clicked main button Map")
            
    If flgPaginaOriginale  Then
                acbMap.MainButton.UseTheme(
    "bigred")
                btnSalva.Visibility = ABM.VISIBILITY_ALL
                btnAnnulla.Visibility = ABM.VISIBILITY_ALL
                CreaDBMem
            
    End If
            
    Return
        
    End If
        
    If SubTarget = "btnsalva" Then
            
    Log("clicked salva button")
            acbMap.MainButton.UseTheme(
    "bigblue")
         
            
    ' Salvare le modifiche nelle tabelle principali
            ' oppure in quelle di proposta (va modificato il database aggiungento una o più tabelle per la gestione delle proposte)
            page.Msgbox2("MSGSALVA","Salvi una proposta o un definitivo?","Salva","Definitivo","Proposta",True,ABM.MSGBOX_TYPE_QUESTION,False,ABM.MSGBOX_POS_CENTER_CENTER,"")
            btnSalva.Visibility = ABM.VISIBILITY_HIDE_ALL
            btnAnnulla.Visibility = ABM.VISIBILITY_HIDE_ALL
            ConnectPage
        
    else if SubTarget = "btnannulla" Then
            
    Log("clicked annulla button")
            
    page.Row(1).RemoveAllComponents
            acbMap.MainButton.UseTheme(
    "bigblue")
            btnSalva.Visibility = ABM.VISIBILITY_HIDE_ALL
            btnAnnulla.Visibility = ABM.VISIBILITY_HIDE_ALL
            ConnectPage
        
    End If 
    End Sub

    Sub page_MsgboxResult(returnName As String, result As String)
        
    Select Case returnName
            
    Case "MSGSALVA"
                
    Select Case result
                    
    Case ABM.MSGBOX_RESULT_CANCEL

    ' It does not perform

                    
    page.InputBox("INPUTBOXPROPOSTA","Nome della proposta", _ 
                                    
    "Ok","Annulla",False, _
                                    ABM.INPUTBOX_TYPE_QUESTION, _
                                    ABM.INPUT_TEXT,
    "", _
                                    
    "Qui inserisci il nome della proposta", _
                                    ABM.INPUTBOX_QUESTIONTYPE_TEXT, _
                                    
    "Nome non valido", _
                                    
    False,ABM.MSGBOX_POS_CENTER_CENTER,"")
                
    End Select
        
    End Select
    End Sub

    Sub Page_InputboxResult(returnName As String, result As String)
        
    Select Case returnName
            
    Case "INPUTBOXPROPOSTA"
                
    Select Case result
                    
    Case ABM.INPUTBOX_RESULT_CANCEL, ABM.INPUTBOX_RESULT_CLOSE, ABM.INPUTBOX_RESULT_ESC, ABM.INPUTBOX_RESULT_OVERLAY, ABM.INPUTBOX_RESULT_INVALID
                        
    ' the user did something to close the inputbox without pressing OK.  These are all different cases of 'CANCEL'
                    Case Else        'salva proposta
                        ' in the result is now the value or selection the user made, the user pressed OK
                        ' creo una stringa per i valori da inserire in tabella
                        ' uso INSERT INTO ProposteGruppi VALUES (x,x,x,x,x,x),(y,y,y,y,y,y) .....
                        Dim ssql As String
                        
    Dim dd As String
                        dd = 
    DateTime.Date(DateTime.Now)
                        
    For i = 0 To mG.Size - 1
                            ssql = 
    "(null," & "5" & "," & mG.Get("idg") & "," & mG.Get("idp") & "," & dd & "," & result & "),"
                        
    Next
                        ssql = 
    "INSERT INTO ProposteGruppi (IDPG,IDC,IDG,IDP,Data,NomeProposta) VALUES " & ssql.SubString2(0,ssql.LastIndexOf(","))
                        
    Dim SQLDB As SQL = ABMShared.SQLGet
                        SQLDB.BeginTransaction
                        
    Try
                            SQLDB.ExecNonQuery(ssql)
                            SQLDB.TransactionSuccessful
                        
    Catch
                            SQLDB.Rollback
                            
    Log(LastException)
                            MyToastID = MyToastID + 
    1
                            
    page.ShowToast("toast" & MyToastID, "toastred""ERRORE: Modifiche NON eseguite!"5000False)
                        
    End Try
                
    End Select
        
    End Select 
    End Sub
     
    Last edited: Dec 4, 2017
  2. magi6162

    magi6162 Well-Known Member Licensed User

    Sorry,
    I can not understand why calling an inputdialog inside an event of a messagebox does not allow the inputbox to appear on the screen.

    thanks for any information.
     
    joulongleu likes this.
  3. alwaysbusy

    alwaysbusy Expert Licensed User

    Probably because the used msgbox/input js library does not allow that (they may get the same z-index, hence it is opened, but you can't see it because it is on the same level. This is something where you would need to use a modalsheet for the frist box. Also note that calling 'ConnectPage' in anything but the Websocket_Connect is a dangerous thing to do! Unexpected things can happen. This method is used for a first-run only.
     
    Harris and joulongleu like this.
  4. Harris

    Harris Well-Known Member Licensed User

    Try it with a different position to see if it actually shows up some where else (like ab suggested - the z order).
    Curious - what was your intent to call ConnectPage at that point? Had it been called previously in WebSocket_connected?
     
  5. magi6162

    magi6162 Well-Known Member Licensed User

    In fact I put a flag to know when it's the first run there ConnectPage. However, given your highly appreciated recommendations, I will bring the code I need out of ConnectPage. Thank you.:)
    As for MessageBox, I opted for a .... ModalSheet.;)
     
    Harris and alwaysbusy like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice