Herramientas Informaticas

Mes: diciembre 2021 Página 1 de 3

QUE HACER DESPUES DE INSTALAR WINDOWS 11

No hace mucho ha sido lanzado la ultima versión de Windows, Windows 11 y pese que aun no es compatible con la mayoría de las maquinas mucha gente se las arregla para saltarse los requisitos minimos

Como recomendación si el equipo no cumple con lo requisitos mínimos es mejor dejar el Windows 10 para el mas correcto funcionamiento, ya que seria si no cumple con los requisitos será aun peor que tener el Windows10

Después de instalar es checamos en el administrador de dispositivos y si hay dispositivos sin controladores lo mejor es dejar que Windows 11 se actualice, normal mente lo hace en automático en el primer inicio

Si al reiniciar observamos que aun hay dispositivos sin controlador instalado podemos usar Driver Booster, que se encargara de buscar e instalar los controladores mas básico de manera gratuita

Al momento de instalarlo debemos elegir la instalación personalizada para evitar instalar programas o publicidad no deseada

Mini Tutorial Programando en GAMBAS3

Les dejo este mini tutorial de gambas en donde vemos como instalarlo, como programar las ventanas, eventos, veremos como tener acceso a la base de datos MySQL, Guardar configuraciones en la maquina “Settings“, como guardar archivos en el disco duro y finalmente como publicar el programa en la granja de software

Como publicar proyecto de gambas3 en la granja de software

Suponiendo que ya esta listo el programa lo que sigue puede ser lo siguiente
1. Crear un simple Ejecutable
2. Crear un paquete de instalación para instalarlo en cualquier distribución de Linux a través de un empaquetado .deb
3. Publicarlo en la granja de software de Gambas3

Lo que haremos es publicarlo en la granja de software

Primero le asignamos un icono al proyecto en las propiedades del proyecto

Aprovechamos para escribir la descripción del proyecto y los autores

Ahora nos vamos al menú Proyecto -> Publicar

Le rellenamos mas datos en caso de ser necesario
Elegimos las etiquetas
Elegimos una captura del programa, esto de mostrara cuando alguien quiera descargar nuestro programa
Elegimos las dependencias
Elegimos si publicarlo con nuestro usuario, aunque se puede publicar bajo el anonimato sin crear usuario en gambasfarm.org

Finalmente le damos Publicar y mostrara el siguiente mensaje comunicándonos de que el proyecto se ha publicado correctamente
Si nos vamos a la granja de software ya estará publicado nuestro proyecto

Como guardar archivos en disco duro con GAMBAS3 File.Save

Ya tenemos las funciones para crear automáticamente los códigos del Modelo/Vista/Controlador para PHP ahora lo que sigue es crear los archivos en el directorio del directorio del proyecto en PHP

Para guardar archivo en Gambas3 usaremos la función File.Save(“ruta donde se va a guardar”,”contenido del archivo”)

Pasos

Le damos doble click al botton para generar el evento _Click
Quedara de la siguiente forma

Insertamos en ese evento el siguiente código

  Dim strModel1 As String
  Dim strControlador As String
  Dim strVista As String 
  
  ' GUARDAR CONFIGURACION

  
  Settings["ruta"] = ruta.SelectedPath
  Settings["tabla"] = txtTabla.Text
  
  ' CREA ARCHIVO DEL MODELO
  strModel1 = creadorModelo.creaModelo()
   
  File.Save(ruta.SelectedPath & "/" & "modelos/" & txtTabla.Text & ".modelo.php", strModel1)
  
  ' CREA ARCHIVO DEL CONTROLADOR
  strControlador = creadorControlador.creaControlador()
  
  File.Save(ruta.SelectedPath & "/" & "controladores/" & txtTabla.Text & ".controlador.php", strControlador)
   
   
  ' CREA ARCHIVO VISTA 
  strVista = creadorVista.creaVista()
  
  File.Save(ruta.SelectedPath & "/" & "vistas/modulos/" & txtTabla.Text & ".php", strVista)
  
  ' MANDAMOS MENSAJE DE QUE TODO SE HA GUARDADO CORRECTAMENTE
  Message.Info("Guardado Correctamente")
Se observa como se usan las funciones para crear el código, por ejemplo, para crear el modelo se usa creadorModelo.creaModelo() y guarda todo el texto/código generado en la variable strModel1

Luego guarda con File.Save en la ruta que seleccionamos con el control llamado “ruta” el texto que esta en strModel

Esta misma lógica se usa para el controlador y la vista

En la siguiente publicación veremos como asignarle un icono al proyecto

Función para crear automáticamente el código de la vista en base a una tabla en MySQL

Ahora solo queda hacer la función para generar automáticamente el código HTML/PHP para la vista del catalogo en base a la nueva tabla.

La lógica es igual solo que es otro texto

Creamos el modulo creadorVista en la carpeta modulos

Insertamos el siguiente codigo

' Gambas module file

Public Function creaVista() As String
  
  Dim strVista As String
  
  Dim conexion As New Connection
  Dim strDatos As String
  


  With conexion
    .Type = "mysql"
    .Port = "3306"
    .Host = Settings["servidor"]
    .User = Settings["usuario"]
    .Password = Settings["password"]
    .Name = Settings["baseDeDatos"]
    .Open()
    End With
    
    Dim $result As Result
    Dim $resultClases As Result
    Dim strLLavePrimaria As String
    
   $result = conexion.Exec("SHOW KEYS FROM  " & FMain.txtTabla.Text & " WHERE Key_name = 'PRIMARY'")
   strLLavePrimaria = $result["Column_name"]
   
   
   conexion.Exec("delete from clases where clase= 'controladores/" & FMain.txtTabla.Text & ".controlador.php'")
   conexion.Exec("delete from clases where clase= 'modelos/" & FMain.txtTabla.Text & ".modelo.php'")
   conexion.Exec("insert into clases(clase) values('controladores/" & FMain.txtTabla.Text & ".controlador.php')")
   conexion.Exec("insert into clases(clase) values( 'modelos/" & FMain.txtTabla.Text & ".modelo.php')")
  
  
   $result = conexion.Exec("describe " & FMain.txtTabla.Text)
  $result = conexion.Exec("describe " & FMain.txtTabla.Text)
  
  
Dim contador As Integer
Dim strEncabezadosTabla As String
Dim strCampos As String
Dim strControlesNuevos As String
Dim strControlesEditar As String
Dim strEditarJS As String
Dim strBloquear As String
Dim strEditarTraeDatos As String

contador = 0
strEncabezadosTabla = ""
strCampos = ""
strControlesNuevos = ""
strEditarJS = ""

While $result.Length > contador
  
  strEncabezadosTabla &= "<th>" & utilerias.strPrimeraMayuscula($result["Field"]) & "</th>" & gb.CrLf 
  
  strCampos &= "<td>'.$value[\"" & $result["Field"] & "\"].'</td>" & gb.CrLf 
  
  If contador > 0

  strControlesNuevos &= "" & "            <!-- ENTRADA PARA " & UCase($result["Field"]) & " --> " & gb.CrLf
  strControlesNuevos &= "" & " " & gb.CrLf
  strControlesNuevos &= "" & "            <div class=\"form-group\"> " & gb.CrLf
  strControlesNuevos &= "" & " " & gb.CrLf
  strControlesNuevos &= "" & "              <div class=\"input-group\"> " & gb.CrLf
  strControlesNuevos &= "" & " " & gb.CrLf
  strControlesNuevos &= "" & "                <span class=\"input-group-addon\">" & utilerias.strPrimeraMayuscula($result["Field"]) & ": </span>  " & gb.CrLf
  strControlesNuevos &= "" & " " & gb.CrLf
  strControlesNuevos &= "" & "                <input type=\"text\" class=\"form-control input-lg\" name=\"nuevo" & utilerias.strPrimeraMayuscula($result["Field"]) & "\" placeholder=\"Ingresar " & utilerias.strPrimeraMayuscula($result["Field"]) & "\" required> " & gb.CrLf
  strControlesNuevos &= "" & " " & gb.CrLf
  strControlesNuevos &= "" & "              </div> " & gb.CrLf
  strControlesNuevos &= "" & " " & gb.CrLf
  strControlesNuevos &= "" & "            </div> " & gb.CrLf
  
  strEditarJS &= "" & "            $(\"#editarDescripcion\").val(respuesta[\"descripcion\"]);" & gb.CrLf

  End If
  
  
  If $result["Key"] == "PRI" 
    strBloquear = "readonly"
    Else
    strBloquear = ""
   End If
    
  
  
  strControlesEditar &= "" & "            <!-- ENTRADA PARA " & UCase($result["Field"]) & " --> " & gb.CrLf
  strControlesEditar &= "" & " " & gb.CrLf
  strControlesEditar &= "" & "            <div class=\"form-group\"> " & gb.CrLf
  strControlesEditar &= "" & " " & gb.CrLf
  strControlesEditar &= "" & "              <div class=\"input-group\"> " & gb.CrLf
  strControlesEditar &= "" & " " & gb.CrLf
  strControlesEditar &= "" & "                <span class=\"input-group-addon\">" & utilerias.strPrimeraMayuscula($result["Field"]) & ": </span>  " & gb.CrLf
  strControlesEditar &= "" & " " & gb.CrLf
  strControlesEditar &= "" & "                <input " & strBloquear & "  type=\"text\" class=\"form-control input-lg\" id=\"editar" & utilerias.strPrimeraMayuscula($result["Field"]) & "\" name=\"editar" & utilerias.strPrimeraMayuscula($result["Field"]) & "\" placeholder=\"Ingresar " & utilerias.strPrimeraMayuscula($result["Field"]) & "\" required> " & gb.CrLf
  strControlesEditar &= "" & " " & gb.CrLf
  strControlesEditar &= "" & "              </div> " & gb.CrLf
  strControlesEditar &= "" & " " & gb.CrLf
  strControlesEditar &= "" & "            </div> " & gb.CrLf
  
  strEditarTraeDatos &= "" & "            $(\"#editar" & utilerias.strPrimeraMayuscula($result["Field"]) & "\").val(respuesta[\"" & $result["Field"] & "\"]); " & gb.CrLf 

  $result.MoveNext
  contador = contador + 1


Wend
  strControlesEditar &= "" & " <input type=\"hidden\" id=\"editar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.text) & "\"  name = \"editar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.text) & "\" > " & gb.CrLf 
  strEncabezadosTabla &= "<th>Acciones</th>" 
  strCampos &= "<td> " & gb.CrLf
  strCampos &= "<div class = \"btn-group\"> " & gb.CrLf
  
  
 
   strCampos &= "                    <button class= \"btn btn-warning btnEditar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\" id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.text) & " = \"'.$value[\"id\"].'\" data-toggle = \"modal\" data-target = \"#modalEditar" & Trim(utilerias.strPrimeraMayuscula(FMain.txtTabla.Text)) & "\"> <i class = \"fa fa-pencil\"> </i> </button> " & gb.CrLf
 
strCampos &= "<button class = \"btn btn-danger btnEliminar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\" id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "= \"'.$value[\"id\"].'\"><i class= \"fa fa-times\"></i></button>" & gb.CrLf
 
strCampos &= "</div>" & gb.CrLf
 
strCampos &= "</td> " & gb.CrLf
    
  strVista &= "" & "<?php" & gb.CrLf
  strVista &= "" & gb.CrLf
  strVista &= "" & "if(\"off\" == \"offf\"){" & gb.CrLf
  strVista &= "" & gb.CrLf
  strVista &= "" & "  echo '<script>" & gb.CrLf
  strVista &= "" & gb.CrLf
  strVista &= "" & "    window.location = \"inicio\"; " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "  </script>'; " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "  return; " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "} " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "?> " & gb.CrLf
  strVista &= "" & "<div class=\"content-wrapper\">" & gb.CrLf 
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "  <section class=\"content-header\">" & gb.CrLf 
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "    <h1> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "      Administrar <?php echo  mb_strtolower(preg_replace('/(?<=\\w)(\\p{Lu})/u', ' $1', ' " & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & " ')); ?> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "    </h1> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "    <ol class=\"breadcrumb\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "      <li><a href=\"inicio\"><i class=\"fa fa-dashboard\"></i> Inicio</a></li> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "      <li class=\"active\">Administrar <?php echo  mb_strtolower(preg_replace('/(?<=\\w)(\\p{Lu})/u', ' $1', '" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & " ')); ?></li> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "    </ol> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "  </section> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "  <section class=\"content\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "    <div class=\"box\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "      <div class=\"box-header with-border\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        <button class=\"btn btn-primary\" data-toggle=\"modal\" data-target=\"#modalAgregar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "          Agregar <?php echo  mb_strtolower(preg_replace('/(?<=\\w)(\\p{Lu})/u', ' $1', '" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & " ')); ?> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        </button> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "      </div> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "      <div class=\"box-body\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "       <table class=\"table table-bordered table-striped dt-responsive tablas\" width=\"100%\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        <thead> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "         <tr> " & gb.CrLf
  strVista &= "" & " " & strEncabezadosTabla
  strVista &= "" & "         </tr>  " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        </thead> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        <tbody> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        <?php " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        $item = null; " & gb.CrLf
  strVista &= "" & "        $valor = null; " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        $" & FMain.txtTabla.Text & "= Controlador" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "::ctrMostrar($item, $valor); " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "       foreach ($" & FMain.txtTabla.Text & " as $key => $value){ " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  
  
  
  strVista &= "" & "          echo ' <tr> " & gb.CrLf

  strVista &= "" & strCampos & gb.CrLf

  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "                </tr>'; " & gb.CrLf
  strVista &= "" & "        } " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        ?>  " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        </tbody> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "       </table> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "      </div> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "    </div> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "  </section> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "</div> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "<!--===================================== " & gb.CrLf
  strVista &= "" & "MODAL <?php echo  mb_strtolower(preg_replace('/(?<=\\w)(\\p{Lu})/u', ' $1', ' " & (FMain.txtTabla.Text) & " ')); ?> " & gb.CrLf
  strVista &= "" & " ======================================--> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "<div id=\"modalAgregar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.text) & "\" class=\"modal fade\" role=\"dialog\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "  <div class=\"modal-dialog\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "    <div class=\"modal-content\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "      <form role=\"form\" method=\"post\" enctype=\"multipart/form-data\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        <!--===================================== " & gb.CrLf
  strVista &= "" & "        CABEZA DEL MODAL " & gb.CrLf
  strVista &= "" & "        ======================================--> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        <div class=\"modal-header\" style=\"background:#3c8dbc; color:white\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "          <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;</button> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "          <h4 class=\"modal-title\">Agregar <?php echo  mb_strtolower(preg_replace('/(?<=\\w)(\\p{Lu})/u', ' $1', ' " & (FMain.txtTabla.Text) & " ')); ?> </h4> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf

  strVista &= "" & "        </div> " & gb.CrLf
 
  strVista &= "" & "        <!--===================================== " & gb.CrLf
  strVista &= "" & "        CUERPO DEL MODAL " & gb.CrLf
  strVista &= "" & "        ======================================--> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        <div class=\"modal-body\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "          <div class=\"box-body\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  'strVista &= "" & "            <!-- ENTRADA PARA DESCRIPCION --> " & gb.CrLf
  
    strVista &= "" & " " & strControlesNuevos & gb.CrLf
  
  
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "          </div> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        </div> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        <!--===================================== " & gb.CrLf
  strVista &= "" & "        PIE DEL MODAL " & gb.CrLf
  strVista &= "" & "        ====================================== --> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        <div class=\"modal-footer\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "          <button type=\"button\" class=\"btn btn-default pull-left\" data-dismiss=\"modal\">Salir</button> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "          <button type=\"submit\" class=\"btn btn-primary\">Guardar</button> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        </div> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        <?php " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "           $crear = new Controlador" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "(); " & gb.CrLf
  strVista &= "" & "           $crear ->ctrIngresar(); " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        ?> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "      </form> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "    </div> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "  </div> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "</div> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "<!--===================================== " & gb.CrLf
  strVista &= "" & "MODAL EDITAR USUARIO " & gb.CrLf
  strVista &= "" & " ======================================--> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "<div id=\"modalEditar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\" class=\"modal fade\" role=\"dialog\">" & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "  <div class=\"modal-dialog\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "    <div class=\"modal-content\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "      <form role=\"form\" method=\"post\" enctype=\"multipart/form-data\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        <!--===================================== " & gb.CrLf
  strVista &= "" & "        CABEZA DEL MODAL " & gb.CrLf
  strVista &= "" & "        ======================================--> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        <div class=\"modal-header\" style=\"background:#3c8dbc; color:white\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "          <button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;</button> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "          <h4 class=\"modal-title\">Agregar <?php echo  mb_strtolower(preg_replace('/(?<=\\w)(\\p{Lu})/u', ' $1', ' " & (FMain.txtTabla.Text) & " ')); ?> </h4> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        </div> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        <!--===================================== " & gb.CrLf
  strVista &= "" & "        CUERPO DEL MODAL " & gb.CrLf
  strVista &= "" & "        ======================================--> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        <div class=\"modal-body\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "          <div class=\"box-body\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "            <!-- ENTRADA PARA DESCRIPCION --> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & strControlesEditar
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "          </div> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        </div> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        <!--===================================== " & gb.CrLf
  strVista &= "" & "        PIE DEL MODAL " & gb.CrLf
  strVista &= "" & "        ======================================--> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        <div class=\"modal-footer\"> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "          <button type=\"button\" class=\"btn btn-default pull-left\" data-dismiss=\"modal\">Salir</button> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "          <button type=\"submit\" class=\"btn btn-primary\">Modificar</button> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        </div> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "     <?php " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "           $editar = new Controlador" & utilerias.strPrimeraMayuscula(FMain.txtTabla.text) & "(); " & gb.CrLf
  strVista &= "" & "           $editar ->ctrEditar(); " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "        ?>  " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "      </form> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "    </div> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "  </div> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "</div> " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "<?php " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "   $borrar = new Controlador" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "(); " & gb.CrLf
  strVista &= "" & "   $borrar ->ctrBorrar(); " & gb.CrLf
  strVista &= "" & " " & gb.CrLf
  strVista &= "" & "?>  " & gb.CrLf
  
  'JAVASCRIPT FUNCIONES
  strVista &= "" & "<script type=\"text/javascript\">" & gb.CrLf
  
    'ELIMINAR
 
  
strVista &= "" & "/*= == == == == == == == == == == == == == == == == == == == == == ==" & gb.CrLf
strVista &= "" & " ELIMINAR " & UCase(FMain.txtTabla.Text) & gb.CrLf
strVista &= "" & " == == == == == == == == == == == == == == == == == == == == == == = */" & gb.CrLf
strVista &= "" & "$(\".tablas\").on(\"click\", \".btnEliminar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\", function() {" & gb.CrLf 

strVista &= "" & "    var id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & " = $(this).attr(\"id" & FMain.txtTabla.Text & "\");" & gb.CrLf

strVista &= "" & "    swal( {" & gb.CrLf
strVista &= "" & "        title: '¿Está seguro de borrar?'," & gb.CrLf
strVista &= "" & "        text: \"¡Si no lo está puede cancelar la accíón!\"," & gb.CrLf
strVista &= "" & "        type: 'warning'," & gb.CrLf
strVista &= "" & "        showCancelButton: true," & gb.CrLf
strVista &= "" & "        confirmButtonColor: '#3085d6'," & gb.CrLf
strVista &= "" & "        cancelButtonColor: '#d33'," & gb.CrLf
strVista &= "" & "        cancelButtonText: 'Cancelar'," & gb.CrLf
strVista &= "" & "       confirmButtonText: 'Si, borrar!'" & gb.CrLf
strVista &= "" & "    }).then(function(result) {" & gb.CrLf
strVista &= "" & "" & gb.CrLf
strVista &= "" & "        if (result.value) {" & gb.CrLf
strVista &= "" & "" & gb.CrLf
strVista &= "" & "            window.location = \"index.php?ruta=" & (FMain.txtTabla.Text) & "&id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "=\"+id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "+\"&borrar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "=borrar\";" & gb.CrLf
strVista &= "" & "" & gb.CrLf
strVista &= "" & "        }" & gb.CrLf
strVista &= "" & "" & gb.CrLf
strVista &= "" & "    })" & gb.CrLf

strVista &= "" & "})" & gb.CrLf


'editar

strVista &= "" & "/* = == == == == == == == == == == == == == == == == == == == == == ==" & gb.CrLf
strVista &= "" & " EDITAR " & gb.CrLf
strVista &= "" & " == == == == == == == == == == == == == == == == == == == == == == = */" & gb.CrLf
strVista &= "" & "$(\".tablas\").on(\"click\", \".btnEditar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\", function() {" & gb.CrLf
strVista &= "" & "" & gb.CrLf
strVista &= "" & "    var id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & " = $(this).attr(\"id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\");" & gb.CrLf
strVista &= "" & "  console.log(id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & ");"
strVista &= "" & "" & gb.CrLf
strVista &= "" & "" & gb.CrLf
strVista &= "" & "    var datos = new FormData();" & gb.CrLf
strVista &= "" & "    datos.append(\"id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\", id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "); " & gb.CrLf 
strVista &= "" & "    datos.append(\"buscar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\", \"buscar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\");" & gb.CrLf
strVista &= "" & "   " & gb.CrLf
strVista &= "" & "" & gb.CrLf
strVista &= "" & "    $.ajax( {" & gb.CrLf
strVista &= "" & "" & gb.CrLf
strVista &= "" & "        url:\"controladores/" & FMain.txtTabla.text & ".controlador.php\"," & gb.CrLf
strVista &= "" & "        method:\"POST\"," & gb.CrLf
strVista &= "" & "        data: datos," & gb.CrLf
strVista &= "" & "        cache: false," & gb.CrLf
strVista &= "" & "        contentType: false," & gb.CrLf
strVista &= "" & "        processData: false," & gb.CrLf
strVista &= "" & "       dataType:\"json\"," & gb.CrLf
strVista &= "" & "       success: function(respuesta) {" & gb.CrLf
strVista &= "" & "" & gb.CrLf
strVista &= "" & strEditarTraeDatos & gb.CrLf
strVista &= "" & "            " & gb.CrLf
strVista &= "" & "        }" & gb.CrLf
strVista &= "" & "" & gb.CrLf
strVista &= "" & "    });" & gb.CrLf
strVista &= "" & "" & gb.CrLf
strVista &= "" & "})" & gb.CrLf

  
  strVista &= "" & "</script>" & gb.CrLf
  Return strVista

End

En la siguiente publicación veremos como generar los archivos modelos/vista/Controlador al darle click al botón Crear Catalogo

Crear función en GAMBAS3 para crear el código para el archivo controlador en php8

Ya hemos visto como crear el archivo modelo en base a la nueva tabla

Para crear el contenido del archivo controlador la lógica es igual

Función en GAMBAS3 para convertir la primera letra de una cadena a Mayúscula

Vimos en la publicación anterior que usamos una función para convertir la primera letra de un texto a mayúsculas por lo tanto vamos a explicar como funciona este código

Es decir si ponemos strPrimeraMayuscula(“prueba”) nos va a devolver “Prueba“, con la P Mayúscula

Primero creamos otro modulo llamado utilitarias, este nos servirá para meter funciones generales

Vemos que se usa la funcion Mid$ que en el primer caso mandamos los parametros 1,1 lo cual solo tomara en cuenta la primer letra del texto y a eso lo metemos a la funcion UCase que lo convierte a mayuscula, luego concatena con Mid$ sin usar UCase pero empezando desde la segunda posición
' Gambas module file

Public Function strPrimeraMayuscula(strCadena As String) As String
  
  Return UCase(Mid$(strCadena, 1, 1)) & Mid$(strCadena, 2, 100) 

End

En la siguiente publicación veremos como generar el texto que va dentro del archivo controlador

Conexión a la base de datos MySQL en GAMBAS

Es necesario podernos conectar a la base de datos del punto de venta para poder leer los campos y en base a esto crear los archivos del catalogo de la tabla nueva

Los pasos son los siguientes

En caso de tener dificultades para encontrar el componente nos podemos ayudar del buscador de arriba
Creamos el modulo creadorModelo en la carpeta módulos, este archivo contendrá la función con la cual se conectara a la base de datos y leerá la la tabla y con esos datos creara el archivo modelo.php

Ahora pegamos el siguiente código

' Gambas module file

Public Function creaModelo() As String

Dim strModelo As String
Dim conexion As New Connection

  ' AQUI ABRIMOS LA CONEXION
  With conexion
    .Type = "mysql"
    .Port = "3306"
    .Host = Settings["servidor"]
    .User = Settings["usuario"]
    .Password = Settings["password"]
    .Name = Settings["baseDeDatos"]
    .Open()
  End With
  
  Dim $result As Result
  Dim strCampos As String
  Dim strCamposNoLLave As String
  Dim strLLavePrimaria As String
  Dim strCamposValue As String
  Dim strBindingInsert As String
  Dim strBindingUpdate As String
  
  Dim strCamposUpdate As String
  
  
  
  ' Hacemos el query para detectar la llave primaria
   $result = conexion.Exec("SHOW KEYS FROM  " & FMain.txtTabla.Text & " WHERE Key_name = 'PRIMARY'")
   strLLavePrimaria = $result["Column_name"]
   
   
  ' Identificamos los campos de la tabla nueva
   $result = conexion.Exec("describe " & FMain.txtTabla.Text)


' A partir de aqui vamos creando todo el texto que contendra el archivo tabla.modelo.php

Dim contador As Integer


contador = 0 

While $result.Length > contador
  
 ' CAMPOS PARA EL Select
  If contador == 0 Then 
    strCampos = $result["Field"] & gb.CrLf
     Else 
     strCampos = strCampos & "," & $result["Field"] & gb.CrLf
  Endif
  
  'CAMPOS PARA EL INSERT
  
  If $result["Key"] <> "PRI" Then
    If contador == 1 Then 
      strCamposNoLLave = $result["Field"] & gb.CrLf
      Else 
      strCamposNoLLave = strCamposNoLLave & "," & $result["Field"] & gb.CrLf
    Endif
    
  Endif
  
  
  
    ' CAMPOS PARA EL VALUE
    
    If $result["Key"] <> "PRI" Then
      If contador == 1 Then 
        strCamposValue = ":" & $result["Field"] & gb.CrLf
      Else 
        strCamposValue = strCamposValue & "," & ":" & $result["Field"] & gb.CrLf
        Endif
    Endif
    
     If $result["Key"] <> "PRI"
      strBindingInsert = strBindingInsert & "     $stmt -> bindParam(\":" & $result["Field"] & "\", $datos[\"nuevo" & UCase(Mid$($result["Field"], 1, 1)) & Mid$($result["Field"], 2, 100) & "\"], PDO::PARAM_STR);" & gb.CrLf
    Endif
    
    ' CAMPOS UPDATE
    If $result["Key"] <> "PRI" Then
      
      If contador == 1 Then 
          
          strCamposUpdate = strCamposUpdate & $result["Field"] & "= :" & $result["Field"] 
          
        Else 
          
           strCamposUpdate = strCamposUpdate & "," & $result["Field"] & "= :" & $result["Field"] 
          
      Endif
      
    Endif
    
    strBindingUpdate = strBindingUpdate & "     $stmt -> bindParam(\":" & $result["Field"] & "\", $datos[\"editar" & utilerias.strPrimeraMayuscula($result["Field"]) & "\"], PDO::PARAM_STR);" & gb.CrLf

  $result.MoveNext
  contador = contador + 1



Wend

strModelo = ""
strModelo &= "<?php" & gb.CrLf
strModelo &= "require_once \"conexion.php\";" & gb.CrLf
strModelo &= "" & "" & gb.CrLf



strModelo &= "" & "Class Modelo" & UCase(Mid$(FMain.txtTabla.text, 1, 1)) & Mid$(FMain.txtTabla.text, 2, 25) & " {" & gb.CrLf
strModelo &= "" & "   /* =============================================" & gb.CrLf
strModelo &= "" & "     MOSTRAR " & UCase(FMain.txtTabla.text) & gb.CrLf 
strModelo &= "" & "      ============================================= */" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "    Static Public Function mdlMostrar($tabla, $item, $valor) {" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "       If ($item != Null) {" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "           $stmt = Conexion:: conectar() -> prepare( \"Select " & strCampos

strModelo &= "" & "           From " & FMain.txtTabla.Text & " a WHERE $item =:$item \"); " " " & gb.CrLf 
strModelo &= "" & "" & gb.CrLf


strModelo &= "" & "           $stmt -> bindParam( \":\" .$item, $valor, PDO::PARAM_STR);" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "           Try {" & gb.CrLf
strModelo &= "" & "               $stmt -> execute();" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "                Return $stmt -> fetch();" & gb.CrLf
strModelo &= "" & "           } Catch (PDOException $e) {" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "               $arr = $stmt -> errorInfo();" & gb.CrLf
strModelo &= "" & "                $arr[3] = \" Error \";" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "               If ($e -> getMessage() == 23000) {" & gb.CrLf
strModelo &= "" & "                   $mensaje = \" El registro esta duplicado, Favor de checar el numero de nomina \";" & gb.CrLf
strModelo &= "" & "                   Return $mensaje;" & gb.CrLf
strModelo &= "" & "               } Else {" & gb.CrLf
strModelo &= "" & "                  Return $arr[2];" & gb.CrLf
strModelo &= "" & "              }" & gb.CrLf
strModelo &= "" & "           }" & gb.CrLf
strModelo &= "" & "           " & gb.CrLf
strModelo &= "" & "           " & gb.CrLf
strModelo &= "" & "       } Else {" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "           $stmt = Conexion:: conectar() -> prepare(\"Select * " "" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "           " & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "           From " & FMain.txtTabla.Text & " a \"); " "" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "           $stmt -> execute();" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "           Return $stmt -> fetchAll();" & gb.CrLf
strModelo &= "" & "       }" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "       $stmt -> close();" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "        $stmt = Null;" & gb.CrLf
strModelo &= "" & "   }" & gb.CrLf
strModelo &= "" & "" & gb.CrLf

' REGISTRO

strModelo &= "" & "   /* ==================================================================" & gb.CrLf
strModelo &= "" & "     REGISTRO" & gb.CrLf
strModelo &= "" & "    ==================================================================== */" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "   Static Public Function mdlIngresar($tabla, $datos) {" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "      $stmt = Conexion:: conectar() -> prepare(\"INSERT INTO " & FMain.txtTabla.Text & "(" & strCamposNoLLave & "" "" & gb.CrLf
strModelo &= "" & "        " & gb.CrLf
strModelo &= "" & "                                                                       )" & gb.CrLf
strModelo &= "" & "                                                                       VALUES(" & strCamposValue & ")" & gb.CrLf
strModelo &= "" & "                          " & gb.CrLf
strModelo &= "" & "                                                                              \"); " "" & gb.CrLf
strModelo &= "" & ""

strModelo &= "" & strBindingInsert & gb.CrLf

strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "       If ($stmt -> execute()) {" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "           Return \"ok\";" & gb.CrLf
strModelo &= "" & "       } Else {" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "           $arr = $stmt -> errorInfo();" & gb.CrLf
strModelo &= "" & "           $arr[3] = \" Error \";" & gb.CrLf
strModelo &= "" & "          Return $arr[2];" & gb.CrLf
strModelo &= "" & "      }" & gb.CrLf

strModelo &= "" & "      $stmt -> close();" & gb.CrLf

strModelo &= "" & "      $stmt = Null;" & gb.CrLf
strModelo &= "" & "  }" & gb.CrLf



'EDITAR ACTUALIZAR
strModelo &= "" & "  /* ==================================================================" & gb.CrLf
strModelo &= "" & "   EDITAR " & gb.CrLf
strModelo &= "" & "     ================================================================== */" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "   Static Public Function mdlEditar($tabla, $datos) {" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "       $stmt = Conexion:: conectar() -> prepare(\" UPDATE $tabla SET " & strCamposUpdate & " " "" & gb.CrLf
strModelo &= "" & ""
strModelo &= "" & "                                                                   WHERE id =:" & strLLavePrimaria & "  \"); " "" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & strBindingUpdate
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "       If ($stmt -> execute()) {" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "           Return \"ok\";" & gb.CrLf
strModelo &= "" & "     } Else {" & gb.CrLf
strModelo &= "" & ""
strModelo &= "" & "          Return \"Error\";" & gb.CrLf
strModelo &= "" & "      }" & gb.CrLf
strModelo &= "" & ""
strModelo &= "" & "     $stmt -> close();" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "      $stmt = Null;" & gb.CrLf
strModelo &= "" & "   }" & gb.CrLf
strModelo &= "" & "   " & gb.CrLf
strModelo &= "" & " " & gb.CrLf & gb.CrLf
strModelo &= "" & "  /* ===================================================================" & gb.CrLf
strModelo &= "" & "     BORRAR USUARIO" & gb.CrLf
strModelo &= "" & "     =================================================================== */" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "  Static Public Function mdlBorrar($tabla, $datos) {" & gb.CrLf

strModelo &= "" & "       $stmt = Conexion:: conectar() -> prepare( \" DELETE From " & FMain.txtTabla.Text & " WHERE id =:id \");" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "       $stmt -> bindParam(\":id\", $datos, PDO::PARAM_INT);" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "      If ($stmt -> execute()) {" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "Return \"ok\";" & gb.CrLf
strModelo &= "" & "      } Else {" & gb.CrLf

strModelo &= "" & "          Return \"Error\";" & gb.CrLf
strModelo &= "" & "      }" & gb.CrLf

strModelo &= "" & "        $stmt -> close();" & gb.CrLf

strModelo &= "" & "       $stmt = Null;" & gb.CrLf
strModelo &= "" & "    }" & gb.CrLf
strModelo &= "" & "" & gb.CrLf
strModelo &= "" & "}" & gb.CrLf

Return strModelo
  
End

Ahora explicamos las partes importantes

Aqui vemos como abrir una conexión a la base de datos, se observa como se usan las variables de configuración programadas en la publicación anterior
Y aquí vemos como ejecutar los querys en la base de datos y guardamos el resultado en la variable $result y luego leemos el nombre de la columna asignase la a la variable strLLavePrimeria

Podemos ejecutar cualquier query por ejemplo conexion.Exec(“select * from usuarios”)
Dentro del código vemos que usamos la función utilerias.strPrimeraMayuscula, pues lo que hace esta función es poner en mayúscula la primera letra de la cadena, en la siguiente publicación pondremos y explicaremos esa función

Guardando configuraciones en Gambas3

Esta utilidad sirve para guardar configuraciones de sistema, configuraciones que solo son por equipo y se quedan guardadas en la maquina y aun si se cierra el programa al volverlo abrir mostrara la información guardada

Para activar esta función nos vamos a propiedades del proyecto seleccionamos componentes y activamos el componente gb.settings

Crear otro formulario e invocarlo desde el menú

Ahora vamos a crear el formulario para guardar las configuraciones de la conexión a la base de datos pero antes de eso debemos de asegurarlos de tener el fuente bien organizado en carpetas para ello crearemos una carpeta llamada formularios y otra llamada módulos

Claro esta que en la carpeta llamada formularios se va a meter todos los formularios

En la carpeta módulos estarán los archivos con las funciones que se van a necesitar

Quedarían de la siguiente forma

Posteriormente le damos click derecho a la carpeta formularios no vamos a nuevo y seleccionamos formulario, le activamos la gestión de cuadro de dialogo y le damos aceptar

Nos quedaría de la siguiente forma dentro de la carpeta formularios

Ahora tenemos que agregar los controles necesarios para capturar la información necesaria que es el servidor, la base de datos el usuario y el password, se hara de la misma forma que se agregaron los controles en la publicación anterior

Quedaría de esta forma, también en los atributos del formulario le podemos poner que siempre aparezca en el medio

Ahora para que aparezca cuando demos click en el sub menu configuración es muy fácil, le damos doble click al sub menu y nos creara la siguiente función

Este es el evento y al darle click se va ejecutar toda instrucción que este escrito dentro de ella

Entonces escribimos la siguiente instrucción

frmFormulario.show
Es muy simple, queda de esta forma
Ahora cuando se le de click en Archivo -> Configuración mostrara la siguiente ventana

En la siguiente publicación mostraremos como guardar los datos de conexión de la base de datos en los registros, y estos siempre estarán guardados aunque se abra y cierre el programa

Página 1 de 3

Creado con WordPress & Tema de Anders Norén