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:(

    Sub acbMap_Clicked(Target As String, SubTarget As String)
    If SubTarget="" Then
    Log("clicked main button Map")
    If flgPaginaOriginale  Then
                btnSalva.Visibility = ABM.VISIBILITY_ALL
                btnAnnulla.Visibility = ABM.VISIBILITY_ALL
    End If
    End If
    If SubTarget = "btnsalva" Then
    Log("clicked salva button")
    ' 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
    else if SubTarget = "btnannulla" Then
    Log("clicked annulla button")
            btnSalva.Visibility = ABM.VISIBILITY_HIDE_ALL
            btnAnnulla.Visibility = ABM.VISIBILITY_HIDE_ALL
    End If 
    End Sub

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

    ' It does not perform

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

    Sub Page_InputboxResult(returnName As String, result As String)
    Select Case returnName
    Select Case result
    ' 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 = 
    For i = 0 To mG.Size - 1
                            ssql = 
    "(null," & "5" & "," & mG.Get("idg") & "," & mG.Get("idp") & "," & dd & "," & result & "),"
                        ssql = 
    "INSERT INTO ProposteGruppi (IDPG,IDC,IDG,IDP,Data,NomeProposta) VALUES " & ssql.SubString2(0,ssql.LastIndexOf(","))
    Dim SQLDB As SQL = ABMShared.SQLGet
                            MyToastID = MyToastID + 
    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

    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.
  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