Spanish [SOLUCIONADO] Datos en Scrollview?

Ingeniero Cognitivo

Active Member
Like any other additional library:
1. Download the ScrollView2D v1.3.zip file from HERE.
2. Unzip the ScrollView2D v1.3 file. you get two files: ScrollView2D.jar and ScrollView2D.xml.
3. Copy these two files into the AdditionalLibraries folder.

Description in chapter 5.8 Libraries in the B4X Basic language booklet, the booklets are in English.
Excelent but i can't to see the table with columns. ¿How can i to use this?.
Thanks
 

klaus

Expert
Licensed User
Longtime User
Sorry, but I do not understand what the problem is ?
You need to explain in detail what exactly you have done.

You need to:
1. Download the project from post #12, unzip it.
2. Download the ScrollView2D v1.3.zip file from HERE, unzip it and save the two files in the AdditionalLibraries folder, as already explained.
3. Run the IDE and load the project.
It contains the Table class and makes reference to the ScrollView2D library.
4. Run the project and you should see this:

1613402082776.png


Barras and Und are the headers of the table.

Then to see any items you need to add a few ones.
Enter two values and press on Inserta and you will see the the two values in the table.

1613402225760.png
 

TheFalcon

Active Member
Licensed User
Longtime User
Bueno ya lo tengo, lo logre, con los ejemplos de José Aguilar y Klaus e sacado adelante lo que quería, ahora me queda cuadrar el table etc pero eso ya no va con el problema.
Aquí os pongo un gif de como quedaría.
Creo , Añado, Borro, y edito los CSV.
video-edit.gif

Cuando inserto la URL se ve el gif, pero luego al postearlo no, aquí pongo el enlace

Al final lo hice con TABLE igualmente pero usando vuestros ejemplos, y scrollview2d
muchísimas gracias, daré el hilo por cerrado.
 

Ingeniero Cognitivo

Active Member
Sorry, but I do not understand what the problem is ?
You need to explain in detail what exactly you have done.

You need to:
1. Download the project from post #12, unzip it.
2. Download the ScrollView2D v1.3.zip file from HERE, unzip it and save the two files in the AdditionalLibraries folder, as already explained.
3. Run the IDE and load the project.
It contains the Table class and makes reference to the ScrollView2D library.
4. Run the project and you should see this:

View attachment 108055

Barras and Und are the headers of the table.

Then to see any items you need to add a few ones.
Enter two values and press on Inserta and you will see the the two values in the table.

View attachment 108056
This is a scroll or a table?
 

TheFalcon

Active Member
Licensed User
Longtime User
Supongo que eso es una tabla. ¿Como se consigue?.

Desde el Diseñador, en customlistview , añades un TABLE.
En mi caso se queda con el nombre tal cual TABLE1

parra Activarlo, yo lo hago al crear la activity: En mi caso uso 2 columnas(aunque depende de la config del cliente pone 3) con sus cabeceras y tamaños.

B4X:
Table1.InitializeTable(2, Gravity.CENTER,False)
Table1.SetHeader(Array As String("Barras", "Und"))
Table1.SetColumnsWidths(Array As Int(80%x,20%x))

Para ir añadiendo al TAble los datos que recojo en EDITTEXT lo hago así:

B4X:
Table1.AddRow(Array As String(txtbarras.Text, txtcantidad.Text))

Luego lo guardo y limpio el table. donde yo tengo la variable separador Equivale al separador que se va a usar, ya que doy al cliente la posibilidad de usar el que quiera desde la configuración. pero si usas uno fijo puedes usar el genérico ";"

B4X:
Table1.SaveTableToCSV2(File.DirRootExternal,"Miarchivo.csv",separador)

Table1.ClearAll


Hasta ahí, crearía el CSV. luego yo hago que una vez Guardado, puedas volver a recuperarlo y hacerle cambios.

Modificar el Table. Yo cuando hago un Table1_CELLCLICK me carga los valores en otros EDITTEX que uso para editar.

B4X:
    mi_columna = col
    mi_row = row
   
   
'    Cantidad_Pinchada = Table1.GetValue(1, Row) ' el valor 1 seria la 2 columna que es titulo

    barras_edit.Text = Table1.GetValue(0, mi_row)
    barras_edit.SelectionStart = barras_edit.Text.Length
   
    cant_edit.Text = Table1.GetValue(1, mi_row)
    cant_edit.SelectionStart = cant_edit.Text.Length

Luego con un botón de Guardar, guardo el valor que haya añadido a los edittext, en la fila seleccionada, sustituyendo los anteriores

B4X:
Table1.SetValue(0,mi_row,barras_edit.Text)'actualizamos el codigo de barras
Table1.SetValue(1, mi_row, cant_edit.Text) ' actualizamos la cantidad


Si quiero borrar la fila seleccionada usaría

B4X:
Table1.RemoveRow(mi_row)


Para cargar un CSV en la Tabla uso.
B4X:
Table1.LoadTableFromCSV2(File.DirRootExternal, "Miarchivo.csv", True, separador, False)


Espero haberte ayudado y aclarado, si no pregunta lo que sea.
Siempre he dicho en este foro que me explico como un libro cerrado, pero he intentado ponerlo todo paso a paso.

Un saludo

PostData: Lo único que no he conseguido es que me guarde el CSV sin las cabeceras. pero seguiré probando, a ver como leches hago que en el csv me suprima los títulos de cabeceras.
 

klaus

Expert
Licensed User
Longtime User
Top