MapInfo Pro

 View Only
  • 1.  ERROR IN CONDITION WITHIN A DIALOGUE BOX

    Posted 21 days ago
    Hi
    I want to make a dialog box which, if a condition is met, does not show the ACCEPT or SAVE buttons. But it gives me error.

    C:\Users\Usuario\Desktop\EIEL\EIELORACLE>Echo off 
    (aliviadero.mb:598) Unrecognized command: Control. 
    Sub ALIVIADERO_FORM
    OnError GoTo etiquetaError
    Dim dateFECHAC as Date
    Dim dateFECHAM as Date
    ' conversion de la variable string en formato date
    If strACTION="SHOW" Then
    'si es inserción recogermos la fecha actual
    dateFECHAC = CurDate()
        dateFECHAM = CurDate()
    Else
    'si el campo fecha esta vacio mostramos la fecha actual para evitar errores
    If strFECHAC="" Then
    dateFECHAC = strFECHAC
    Else
    dateFECHAC = FormatDate$(strFECHAC)
    End If
    If strFECHAM="" Then
    dateFECHAM = strFECHAM
    Else
    dateFECHAM = FormatDate$(strFECHAM)
    End If
           
        End If
        Dialog
            Title "ALIVIADERO"
            Width 289 Height 290
    Calling ALIVIADERO_CHECK_EDITION
    'DECLARACION DE LAS LABEL Y CAMPOS
    'FASE
    Control StaticText
            Title "*"
            Position 5,4
            Width 15 Height 9
            Control StaticText
                Title "FASE"
                Position 13,4
                Width 46 Height 9  
            Control EditText
                Value strFASE
                Position 89,3
                Width 190 Height 12
                ID ID_FASE Disable
                
     
                
            'DENOMINACION
            Control StaticText
            Title "*"
            Position 5,124
            Width 15 Height 9
            Control StaticText
                Title "DENOMINACIÓN"
                Position 13,124
                Width 75 Height 9  
            Control EditText
                Value strDENOMINACION
                Position 89,123
                Width 190 Height 12
                ID ID_DENOMINACION 
                
            'DISPONE_ACU
            Control StaticText
            Title "*"
            Position 5,139
            Width 15 Height 9
            Control StaticText
                Title "DISPONE DE ACU."
                Position 13,139
                Width 75 Height 9  
            Control PopupMenu
                Title gblAUX_DISPONIBLIDAD
                Value strDISPONE_ACU
                Position 89,138
                Width 190 Height 12
                ID ID_DISPONE_ACU 
                
                
            Control GroupBox
    Title ""
    Position 5, 154 Width 279 Height 2    
                            
            'OBSERVACIONES
            Control StaticText
                Title "OBSERVACIONES"
                Position 13,164
                Width 75 Height 9  
            Control EditText
                Value strOBSERVA
                Position 89,162
                Width 190 Height 12
                ID ID_OBSERVA
                
            Control GroupBox
    Title ""
    Position 5, 180 Width 279 Height 2      
                
            Control StaticText
                Title "CREACIÓN DEL DATO"
                Position 13,190
                Width 80 Height 9
                
            Control StaticText
                Title "USUARIO"
                Position 13,205
                Width 40 Height 9
                
            Control EditText
                Value strUSUAC
                Position 65,204
                Width 80 Height 12
                ID ID_AUDIT_USUAC
                Disable
                
            Control StaticText
                Title "FECHA"
                Position 13,220
                Width 40 Height 9
                
            Control EditText
    Value dateFECHAC
                Position 65,219
                Width 80 Height 12
                ID ID_AUDIT_FECHAC
                Disable
                
            Control StaticText
                Title "MODIFICACIÓN ÚLTIMA DEL DATO"
                Position 160,190
                Width 120 Height 9
                
            Control StaticText
                Title "USUARIO"
                Position 160,205
                Width 40 Height 9
                
            Control EditText
                Value strUSUAM
                Position 200,204
                Width 80 Height 12
                ID ID_AUDIT_USUAM
                Disable
                
            Control StaticText
                Title "FECHA"
                Position 160,220
                Width 40 Height 9
                
            Control EditText
                Value dateFECHAM
                Position 200,219
                Width 80 Height 12
                ID ID_AUDIT_FECHAM
                Disable    
                
            Control StaticText
            Title "* Datos obligatorios entrega al Ministerio"
            Position 5,240
            Width 190 Height 9
           
          Control StaticText
          Title "** Otros datos obligatorios"
          Position 5,250
          Width 190 Height 9
        ' Mostrar botones solo si strACTION no es 'VIEW'
            If strACTION <> "VIEW" Then
                'BOTONES DEL FORMULARIO
                Control OkButton
                    Title "&ACEPTAR"
                    ID ID_ACEPTAR
                    Position 96,270
                    Width 50 Height 14
                    Calling ALIVIADERO_OK
                Control CancelButton
                    Title "&CANCELAR"
                    Position 149,270
                    Width 50 Height 14  
            End If           
         
                
    Exit Sub
    etiquetaError:
    Note "ERROR : " +  Chr$(13) & Chr$(10) + Error$()
    End Sub



    ------------------------------
    Mayca González Pérez
    COMUNIDAD. AUT. REG MURCIA
    ------------------------------


  • 2.  RE: ERROR IN CONDITION WITHIN A DIALOGUE BOX

    Posted 21 days ago

    Hi Mayca,

    You cannot use an "If" condition within your "Dialog" statement.  You need to set up the variables beforehand instead.  To do this, I would use variables to position the buttons off-screen (that is, outside the boundary of the Dialog) if they are not to be displayed.

    Therefore, before calling the Dialog you could have:

      Dim nButtonYPos As Integer

      If strACTION <> "VIEW" Then
               ' Buttons will be displayed on the form
               nButtonYPos = 270
      Else
               ' Buttons will not be displayed on the form
               nButtonYPos = 300
      End If
    Then use the nButtonYPos variable as the Y position of your buttons.  Note that even though these buttons are off-screen, I believe pressing Escape will still call the Cancel button and pressing Enter will still call the OK button.  Changing these to "Button" controls rather than "OKButton" and "CancelButton" may help with this.
    Alternatively, you might be able to use the "Hide" option that is available for a Control, then issue an Alter Control statement to either Show or Hide your buttons.  It looks like you are intending to check the condition within your handler routine "ALIVIADERO_CHECK_EDITION", so should be able to issue an Alter Control Statement in that routine that either shows or hides the buttons based on the appropriate condition.


    ------------------------------
    James Nolet
    GIS Manager
    Caf Consulting
    Mentone office, VIC, Australia
    ------------------------------



  • 3.  RE: ERROR IN CONDITION WITHIN A DIALOGUE BOX

    Posted 20 days ago

    Ok. Thanks



    ------------------------------
    Mayca González Pérez
    COMUNIDAD. AUT. REG MURCIA
    ------------------------------