Android Question It's possible to change & edit B4XTable control?

joaquinortiz

Active Member
Licensed User
Longtime User
Dear @Erel , I have a new requirement. Its possible to change the B4XTable control?

For example the B4xFieldtext that it's using inside B4XTable, can I resize it more bigger? or the next & previous buttons can resize to small size?

This is because an user told me that it's to small typing and clicking in search button.
 

Attachments

  • B4XTable_1.png
    B4XTable_1.png
    58.8 KB · Views: 242

mangojack

Expert
Licensed User
Longtime User
To increase the SearchField font size ..
B4X:
B4XTable1.SearchField.TextField.TextSize = 28


I could change the SearchField position and size , but height seemed to have no effect ??
B4X:
B4XTable1.SearchField.mBase.SetLayoutAnimated(0, B4XTable1.mBase.Width- 310dip, 0, 300dip, 40dip)



or the next & previous buttons can resize to small size?

you could play around with navigation positions and sizing , But I thought it was a little difficult to navigate using non default size.

are you sure you wanted smaller. ?? (you are not saving much room anyway)

B4X:
B4XTable1.lblFirst.SetLayoutAnimated(0, 0 ,5dip, 20dip, 20dip)
B4XTable1.lblBack.SetLayoutAnimated(0, 30dip, 5dip, 20dip, 20dip)
B4XTable1.lblNumber.SetLayoutAnimated(0, 55dip, 0, 40dip, 30dip)
B4XTable1.lblNext.SetLayoutAnimated(0, 100dip, 5dip, 20dip, 20dip)
B4XTable1.lblLast.SetLayoutAnimated(0, 130dip, 5dip, 20dip, 20dip)
B4XTable1.lblFirst.TextSize = 20
B4XTable1.lblBack.TextSize = 20
B4XTable1.lblNext.TextSize = 20
B4XTable1.lblLast.TextSize = 20
B4XTable1.lblNumber.TextSize = 22


This might be of interest ...
 
Upvote 0

joaquinortiz

Active Member
Licensed User
Longtime User
you could play around with navigation positions and sizing , But I thought it was a little difficult to navigate using non default size.

are you sure you wanted smaller. ?? (you are not saving much room anyway)
Well, my suggestion was to see how to decrease the navigation buttons (arrows) and to make the search Edittext larger and move it around.

As you can see in the image, the navigation arrows are big, I prefer to resize to small and resize more big the Search. Also as you can see I add my custom navigation buttons bottom of the screen.

Thanks for responding me @mangojack

Another idea, besides your first suggestion?
 

Attachments

  • PrintLabel1.jpeg
    PrintLabel1.jpeg
    171.9 KB · Views: 212
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Upvote 0

mangojack

Expert
Licensed User
Longtime User
I have no other suggestions . Did you try any of the code posted above ?

EDIT ** Forgot to save post This Morning ..

with some thought .. the only other suggestion I can offer is hiding the default navigation buttons and customizing you own navigation & positioning.

B4X:
Sleep(0)
B4XTable1.lblFirst.Parent.Visible = False
B4XTable1.SearchField.TextField.TextSize = 22
B4XTable1.SearchField.mBase.SetLayoutAnimated(0, 5dip, 0, 200dip, 60dip)
B4XTable1.Refresh  'unsure if neccessary

Sub btnFirst_Click
    B4XTable1.CurrentPage = 1
End Sub

Sub btnNext_Click
    B4XTable1.CurrentPage = B4XTable1.CurrentPage + 1
End Sub

Sub btnPrev_Click
    B4XTable1.CurrentPage = B4XTable1.CurrentPage - 1
End Sub

Sub btnLast_Click
    B4XTable1.CurrentPage = B4XTable1.Size / B4XTable1.RowsPerPage  '@@ could not locate more direct method
End Sub

Sub B4XTable1_DataUpdated
    btnFirst.Enabled = B4XTable1.lblFirst.Tag
    btnNext.Enabled = B4XTable1.lblNext.Tag
    btnPrev.Enabled = B4XTable1.lblBack.Tag
    btnLast.Enabled = B4XTable1.lblLast.Tag
    lblPnumber.Text = B4XTable1.lblNumber.Text
End Sub

Screenshot_20201001-092026.png

But I still cannot increase the SearchField height ... which is limiting font size.


I try to add to my code in Sub Activity_Create and it appears an error. Where I should add it?

Immediately after B4XTable1.SetData()
followed by Sleep(0)
 
Last edited:
Upvote 0

joaquinortiz

Active Member
Licensed User
Longtime User
I'm still receiveing this error. What I'm missing?

by the way, thanks for your persistent help!.
 

Attachments

  • B4XTable_3.png
    B4XTable_3.png
    152.4 KB · Views: 110
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Please re-read my last post ... I have made changes.

I'm still receiveing this error. What I'm missing?

I can see no code / reference for a B4XTable ! Where are you Setting up / filling the Table. ?

Thats where the code goes ... after you have called B4XTable1.SetData() followed by Sleep(0)
 
Last edited:
Upvote 0

joaquinortiz

Active Member
Licensed User
Longtime User
B4X:
#Region  Project Attributes
    #ApplicationLabel: PrintLabel
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: True
    #IncludeTitle: False
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    Private btnMenu As Label
    Private btnPrev As Button
    Private btnNext As Button
    Private B4XTable1 As B4XTable
    Private anButton As Animation
    Private clvSlideMenu As CustomListView
    Private mBackPanel As Panel
    '/////////////////////////////////// Se utiliza para ampliar el Ancho de la columna
    Private cvs As B4XCanvas
    Private xui As XUI
    Private NameColumn(5) As B4XTableColumn
    
    Private btnConnectPrinter As Button
    Private iCantEtiquetas As String = ""
    Private dialog As B4XDialog
    Private txtCantidad As B4XFloatTextField
    Private txtEtiquetas As B4XFloatTextField
    Private pnlTitleBar As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("frmArticulos")
    'Se definen los parametros de animacion para objetos
    ConfiguraAnimationButton
    btnMenu.Tag = anButton
    mBackPanel.Initialize("mBackPanel")
    mBackPanel.Color = Colors.Transparent
    Activity.AddView(mBackPanel, -100%x, 0, 100%x, 100%y)
    '///////////////////////////////////////////////////////////
    clvSlideMenu.AsView.Top = btnMenu.Height '+ 10dip
    clvSlideMenu.AsView.Left = 55dip
    clvSlideMenu.AsView.Width = 50%x
    clvSlideMenu.AsView.Height = 100%y - btnMenu.Height
    'AgregaSlideMenu
    clvSlideMenu.AddTextItem(" Version " & Starter.gVersionApp,"1")
    clvSlideMenu.AddTextItem(" Cargar Archivo","2")
    clvSlideMenu.AddTextItem(" ","3")
'    clvSlideMenu.AddTextItem(" ","4")
    clvSlideMenu.AddTextItem(" ","5")
    clvSlideMenu.AddTextItem(" Acerca De","6")
    clvSlideMenu.AddTextItem(" Salir","7")
    
    clvSlideMenu.AsView.Visible = False
    '////////////////////////////////////////////////// Se utilzia para el ancho de la columna
    Dim p As B4XView = xui.CreatePanel("")
    p.SetLayoutAnimated(0, 0, 0, 1dip, 1dip)
    cvs.Initialize(p)
    '////////////////////////////////////////////////// Se utilzia para el ancho de la columna
    fcnCargaArchivo
    dialog.Initialize(Activity)
    dialog.Title = "Piezas en la Caja"
    '////////////////////////////////////////////////////////////
'    B4XTable1.SearchField.TextField.TextSize = 28
    B4XTable1.lblFirst.Parent.Visible = False
    B4XTable1.SearchField.TextField.TextSize = 22
    B4XTable1.SearchField.mBase.SetLayoutAnimated(0, 5dip, 0, 200dip, 60dip)
    B4XTable1.Refresh  'unsure if neccessary
End Sub

Sub Activity_Resume
Log("Resume_Main")
'Log(modBTPrinter.gArticuloDetalleAction)
'Log(modBTPrinter.gPrinterConnected)
    modBTPrinter.gPrinterConnected = False
    btnConnectPrinter.Color = Colors.ARGB(100,194,38,34) 'ROJO
    modBTPrinter.gserial1.Disconnect
'Select modBTPrinter.gArticuloDetalleAction
'    Case ""
'    Case "Imprimir"
'        PrintZPL
'End Select
End Sub

Sub Activity_Pause (UserClosed As Boolean)
    Log("Pause_Main")
    If UserClosed = True Then
        modBTPrinter.gserial1.Disconnect
    End If
End Sub
Sub btnMenu_Click
    Dim lbl As Label
    Dim a As Animation
    lbl = Sender
    a=lbl.Tag
    a.Start(lbl) 'Inicia la animacion
    'Muestra el SlideMenu
    Log("btnMenu_Clic")
    Show
End Sub
'Check if the menu is currently visible
Public Sub isVisible As Boolean
    Return clvSlideMenu.AsView.Visible
End Sub
'Show the SlideMenu
Public Sub Show
    If isVisible = True Then
        Hide
        Return
    End If

    mBackPanel.BringToFront
    clvSlideMenu.AsView.BringToFront
    clvSlideMenu.AsView.Left = 100%x -clvSlideMenu.AsView.Width
    mBackPanel.Left =  0
    clvSlideMenu.AsView.Visible = True
    mBackPanel.Visible = True
End Sub
'Hide the SlideMenu
Public Sub Hide
    If isVisible = False Then Return
    
    clvSlideMenu.AsView.Visible = False
    mBackPanel.Visible = False
    
End Sub
Sub clvSlideMenu_ItemClick (Index As Int, Value As Object)
    Hide

    Select Value
'        Case "1" 'Productos
'            StartActivity(frmProductos)
'            Activity.Finish
        Case "2" 'Cargar Articulos
            fcnCargaArchivo
'        Case "4" 'Connect to Printer
'            fcnConnectToPrinter
        Case "6" 'Acerca de
            StartActivity(frmAcercaDe)
            Activity.Finish
        Case "7" 'Salir
            Msgbox2Async("Desea SALIR de la App?", "Sistema", "Si", "", "No", Null, False)
            Wait For Msgbox_Result (Result As Int)
            If Result = DialogResponse.POSITIVE Then
                SalirFormulario
            End If

        Case Else
'            ToastMessageShow("INDEX: " & Index & " VALUE: " & Value,False)
            ToastMessageShow("Seleccione una opcion valida del menú",False)
    End Select
End Sub
Private Sub mBackPanel_Touch (Action As Int, X As Float, Y As Float)
    If Action = 1 Then
        Hide
    End If
End Sub
Sub ConfiguraAnimationButton
    'Define Animacion para simular un PushButton en lblMenu
    anButton.InitializeAlpha("", 1, 0)
    anButton.Duration = 80
    anButton.RepeatCount = 1
    anButton.RepeatMode = anButton.REPEAT_REVERSE
End Sub
Sub SalirFormulario
'    StartActivity(frmMenu)
    Activity.Finish
End Sub
    '/////////////////////////////////////////////////////////////////////////////
Sub btnPrev_Click
    B4XTable1.CurrentPage = B4XTable1.CurrentPage - 1
End Sub
Sub btnNext_Click
    B4XTable1.CurrentPage = B4XTable1.CurrentPage + 1
End Sub
Sub B4XTable1_DataUpdated
    Dim ShouldRefresh As Boolean
'    btnNext.Enabled = B4XTable1.lblNext.Tag
'    btnPrev.Enabled = B4XTable1.lblBack.Tag
    'NameColumn and NumberColumn are global B4XTableColumns that we want to measure
    For Each Column As B4XTableColumn In Array (NameColumn(0), NameColumn(1), NameColumn(2), NameColumn(3), NameColumn(4))
        Dim MaxWidth As Int
        For i = 0 To B4XTable1.VisibleRowIds.Size - 1
            Dim RowId As Long = B4XTable1.VisibleRowIds.Get(i)
            If RowId > 0 Then
                Dim pnl As B4XView = Column.CellsLayouts.Get(i + 1)
                Dim lbl As B4XView = pnl.GetView(0)
                Dim txt As String = B4XTable1.GetRow(RowId).Get(Column.Id)
                MaxWidth = Max(MaxWidth, cvs.MeasureText(txt, lbl.Font).Width + 10dip)
            End If
        Next
        If MaxWidth > Column.ComputedWidth Or MaxWidth < Column.ComputedWidth - 20dip Then
            Column.Width = MaxWidth
            ShouldRefresh = True
        End If
    Next
    If ShouldRefresh Then
        B4XTable1.Refresh
    End If
End Sub
Sub B4XTable1_CellClicked (ColumnId As String, RowId As Long)
    Dim lmsg As String
    modBTPrinter.gPrinterConnected = True
    If modBTPrinter.gPrinterConnected = False Then
'        MsgboxAsync("You need to connect first to the printer",Starter.gSistema)
        MsgboxAsync("Necesita primero conectarse con la impresora",Starter.gSistema)
    Else
'        Dim input As B4XInputTemplate
'        input.Initialize
'        input.lblTitle.Text = "Ingresa Cantidad de Piezas:"
'        input.ConfigureForNumbers(False, False)
'        Wait For (dialog.ShowTemplate(input, "Aceptar", "", "Cancelar")) Complete (Result As Int)
'        If Result = xui.DialogResponse_Positive Then
'            Dim res As Int = input.Text 'no need to check with IsNumber
'           
'            If res > 9999 Or res = 0 Then
'                MsgboxAsync("Ingreso una Cantidad excesiva o un Valor en CERO. Intente de nuevo",Starter.gSistema)
'            Else
'                iCantEtiquetas = res
''            dialog.Show($"2 * $1.2{res} = $1.2{2 * res}"$, "OK", "", "")
'                '///////////////////////////////////////////////////
'                Dim RowData As Map = B4XTable1.GetRow(RowId)
'                For i=0 To B4XTable1.Columns.Size - 1
'                    RowData = B4XTable1.GetRow(RowId)
'                    Starter.gArticuloDetalle(i) = RowData.GetValueAt(i)
'                    If i <> 4 Then
'                        lmsg = lmsg & Starter.gArticuloDetalle(i) & CRLF & CRLF
'                    End If
'                Next
'                lmsg = lmsg & "Cantidad: " & iCantEtiquetas & CRLF & CRLF
'                Log(modBTPrinter.gserial1.Address)
'
'                lmsg = "Desea Imprimir este Articulo?" & CRLF & CRLF & lmsg
'                Msgbox2Async(lmsg,Starter.gSistema,"Si","No","",Null,False)
'                Wait For Msgbox_Result (Result As Int)
'                If Result = DialogResponse.POSITIVE Then
'                    PrintZPL
'                End If
'            End If
'        End If
        '/////////////////////////////////////////////////////////////////////
        Dim p As B4XView = xui.CreatePanel("")
        p.SetLayoutAnimated(0, 0, 0, 300dip, 150dip)
        p.LoadLayout("frmInputTextBox1")
        dialog.PutAtTop = True 'put the dialog at the top of the screen
        Wait For (dialog.ShowCustom(p, "Aceptar", "", "Cancelar")) Complete (Result As Int)
        If Result = xui.DialogResponse_Positive Then
            '/////////////////////////////////////////
            If txtCantidad.Text = "" Or txtEtiquetas.Text = "" Then
                MsgboxAsync("Requiere ingresar valores en Cantidad de Piezas por Caja y/o Cantidad de Etiquetas a Imprimir para continuar. Intente de nuevo",Starter.gSistema)
            Else
                Dim ltxtCant As Int = txtCantidad.Text ' input.Text 'no need to check with IsNumber
                If ltxtCant > 9999 Or ltxtCant <= 0 Then
                    MsgboxAsync("Ingreso una Cantidad valida entre 1 y 9999. Intente de nuevo",Starter.gSistema)
                Else
                    Dim ltxtEtiquetas As Int = txtEtiquetas.Text
                    If ltxtEtiquetas > 99 Or ltxtEtiquetas <= 0 Then
                        MsgboxAsync("Debe de ingresar valores validos entre 1 a 99. Intente de nuevo",Starter.gSistema)
                    Else
                        '///////////////////////////////////////////////////
                        iCantEtiquetas = ltxtCant
                        Dim RowData As Map = B4XTable1.GetRow(RowId)
                        For i=0 To B4XTable1.Columns.Size - 1
                            RowData = B4XTable1.GetRow(RowId)
                            Starter.gArticuloDetalle(i) = RowData.GetValueAt(i)
                            If i <> 4 Then
                                lmsg = lmsg & Starter.gArticuloDetalle(i) & CRLF & CRLF
                            End If
                        Next
                        lmsg = lmsg & "Cantidad: " & txtCantidad.Text & CRLF & CRLF
                        Log(modBTPrinter.gserial1.Address)
                
                        lmsg = "Desea Imprimir este Articulo?" & CRLF & CRLF & lmsg
                        Msgbox2Async(lmsg,Starter.gSistema,"Si","No","",Null,False)
                        Wait For Msgbox_Result (Result As Int)
                        If Result = DialogResponse.POSITIVE Then
                            For i= 1 To ltxtEtiquetas
'                                PrintZPL
                                ToastMessageShow("Enivando Impresion Etiqueta -" & i,False)
                            Next
                        End If
                    End If

                End If
            End If
            '/////////////////////////////////////////       
        End If
    End If
End Sub
'///////////////////////////////////////////////////////////////////////
Sub fcnCreateColumns
    
    NameColumn(0) = B4XTable1.AddColumn("ARTICULO", B4XTable1.COLUMN_TYPE_TEXT)
    NameColumn(1) = B4XTable1.AddColumn("CÓDIGO SIN ESPACIOS", B4XTable1.COLUMN_TYPE_TEXT)
    NameColumn(2) = B4XTable1.AddColumn("DESCRIPCIÓN", B4XTable1.COLUMN_TYPE_TEXT)
    NameColumn(3) = B4XTable1.AddColumn("U/M", B4XTable1.COLUMN_TYPE_TEXT)
    NameColumn(4) = B4XTable1.AddColumn("Longitud", B4XTable1.COLUMN_TYPE_TEXT)
        
End Sub
Sub fcnLoadData
    Dim headers As List
    Private const CSVFileName As String = Starter.gExcelProducto_Plantilla
    
    'load the data
    Dim su As StringUtils
    headers.Initialize 'the list is only used to skip the headers row
    
'    Dim folder As String = File.DirInternal
'    If File.Exists(File.DirInternal, CSVFileName) Then
'        folder = File.DirInternal
'    Else
'        File.Copy(File.DirAssets, CSVFileName, File.DirInternal, CSVFileName)
'    End If
    
    Dim data As List = su.LoadCSV2(Starter.gSQLDataBasePath, CSVFileName, ",", headers)
    B4XTable1.SetData(data)
    
'    'change the visible colums order
'    'remove the number columns
'    B4XTable1.VisibleColumns.RemoveAt(B4XTable1.VisibleColumns.IndexOf(NumberColumn))
'    B4XTable1.VisibleColumns.InsertAt(1, NumberColumn)
    B4XTable1.Refresh
End Sub
Sub fcnCargaArchivo
    If File.Exists(Starter.gSQLDataBasePath, Starter.gExcelProducto_Plantilla) Then
        B4XTable1.Clear
        fcnCreateColumns
        fcnLoadData
'        MsgboxAsync("Se cargo con exito la base de datos de Articulos",Starter.gSistema)
'        File.Delete(Starter.gSQLDataBasePath,Starter.gExcelProducto_Plantilla)
    Else
        MsgboxAsync("El Archivo EXCEL de Articulos NO EXISTE. Requiere copiarla a la carpeta de trabajo" & CRLF & CRLF & "Ejemplo: /device/Android/data/com.printlabel/files/",Starter.gSistema)
        
    End If
End Sub
Sub fcnConnectToPrinter
    If modBTPrinter.gPrinterConnected = True Then
        modBTPrinter.gserial1.Disconnect
            btnConnectPrinter.Color = Colors.ARGB(100,194,38,34) 'ROJO
        modBTPrinter.gPrinterConnected = False
    Else
        
        modBTPrinter.gserial1.Initialize("serial1")
        Dim PairedDevices As Map
        PairedDevices = modBTPrinter.gserial1.GetPairedDevices
        Dim l As List
        l.Initialize
        For i = 0 To PairedDevices.Size - 1
            l.Add(PairedDevices.GetKeyAt(i)) 'add the friendly name to the list
        Next
        If l.Size= 0 Then
            btnConnectPrinter.Color = Colors.ARGB(100,194,38,34) 'ROJO
            modBTPrinter.gPrinterConnected = False
'            MsgboxAsync("There is NO BlueTooth paired printer","Warning!!!")
            MsgboxAsync("No hay ninguna Impresora Bluetooth conectada" & CRLF & CRLF & "Conecte primero una impresora",Starter.gSistema)
        Else
            Dim res As Int
            res = InputList(l, "Select Zebra Printer", -1) 'show list with paired devices
            If res <> DialogResponse.CANCEL Then
                ProgressDialogShow("Connecting to Printer, Please Wait ...")
                modBTPrinter.gserial1.Connect(PairedDevices.Get(l.Get(res))) 'convert the name to mac address
                modBTPrinter.gPrinterConnected = True
            Else
                modBTPrinter.gserial1.Disconnect
                modBTPrinter.gPrinterConnected = False
            End If
        End If
    End If

End Sub
Sub Serial1_Connected (Success As Boolean)
'    ProgressDialogHide
    Log("connected: " & Success)
    If Success = False Then
'        BtnPrint.Enabled =False
'        BtnConnectBT.Enabled=True
'        LblState.TextColor=Colors.Red
'        LblState.Text="DISCONNECTED"
        modBTPrinter.gPrinterConnected = False
        btnConnectPrinter.Color = Colors.ARGB(100,194,38,34) 'ROJO
        ProgressDialogHide
'        MsgboxAsync("Could NOT connect to Printer. Retry","Warning!!!")
        MsgboxAsync("El dipositivo móvil NO logró conectarse con la Impresora.",Starter.gSistema)
        Log(LastException.Message)
    Else
'        LblState.TextColor=Colors.Magenta
'        LblState.Text="CONNECTED"
'        BtnPrint.Enabled = True
'        BtnConnectBT.Enabled=False
        modBTPrinter.gPrinterConnected = True
        btnConnectPrinter.Color = Colors.ARGB(100,84,194,32)
        ProgressDialogHide
    End If
End Sub

Sub btnConnectPrinter_Click
    fcnConnectToPrinter
End Sub
Sub PrintZPL
    Dim fechahoy As String
    Log(modBTPrinter.gserial1.Address)
    DateTime.DateFormat = "dd/MM/yyyy"
    fechahoy = DateTime.Date(DateTime.Now)
    Dim Desc1, Desc2 As String
    If Starter.gArticuloDetalle(2).Length >30 Then
        Desc1 = Starter.gArticuloDetalle(2).SubString2(0,31)
        Desc2 = Starter.gArticuloDetalle(2).SubString(31)
    End If
    '///////////////////////////////////////////////////////////////
'    Private AStreams As AsyncStreams 'RandomAccessFile library
    Dim Line1Byte(), Line2Byte(), Line3Byte(),Line4(),Line5(),Line6(),Line7(),Line8(),Line9(),Line10()   As Byte
    Dim Line11(), Line12(), Line13(),Line14(),Line15(),Line16(),Line17(),Line18(),Line19(),Line20()   As Byte
    Dim Line21(), Line22() As Byte
    Line1Byte= modBTPrinter.gConv.StringToBytes("^XA~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR6,6~SD15^JUS^LRN^CI0^XZ","UTF8")
    Line2Byte=modBTPrinter.gConv.StringToBytes("^XA","UTF8")
    Line3Byte=modBTPrinter.gConv.StringToBytes("^MMT","UTF8")
    Line4=modBTPrinter.gConv.StringToBytes("^PW812","UTF8")
    Line5=modBTPrinter.gConv.StringToBytes("^LL0406","UTF8")
    Line6=modBTPrinter.gConv.StringToBytes("^LS0","UTF8")
    Line7=modBTPrinter.gConv.StringToBytes("^FO0,0^GFA,03072,03072,00024,:Z64:","UTF8")
    Line8=modBTPrinter.gConv.StringToBytes("eJztVTtupEAUfI0GCxGgGWnIR45GBJyhHThnJPoWls/QcrTRnqFD1KeYo6CNCKw+w1Z/ANs8wpWslXtEQE1RXa/egyb6Wf/XKndwtYO7kYWF6lg8swOL56pn8cq9s3i9w2+sZXGl+AKccxwsPP+wxTNrrS54fnfc4hX0uYRy8JXc4iX8W7NjiOGHAjQDy5otuBywAcOve57fuooNSCm+Yda+cQ2A+2eW79wfN7H8J26AEL/h4gFfcvFkCL/VPJ9xE/Q5fI9PbHPJ5yNz7gVA+A33AiD8muO3Di+Y3thBv4R62lgqdTbQkDF8XJ1g+Ch5zMaveO75codvMsPq7/G/6uewrgTmE3yBsuEs4I3VmB7T4KLSatQS9znVoj6hYs+vEatMfD8K4LbubaTX3+MDfsFLl8s8uAG/D3fBl/ftNYN/n5IpQ07gdSLxoYwn6iCPFIfAH0MFLzRV0b6kbtb3O1B/nmu9zvrYoaGmmbM5Qj88gWfPdO4/86H+cKeW2mnOvp/1Az/NRWntsOjjI0Fliud2W/zjq9JTLHflQ99/haiKbajDHos+bpJ+8JT0fTLlsMxCvvqnxY9O/Ogfo/r+kb/q9/1nvkkTNKR8JJFY8ySa8zerfpigqdIpf1yxW34S0OHIH2KPU39p6e8Z+Z/CDj0OsWUe/PxkmB9ou/urm6p7nB+8ip1QwYvCkPpezw0w5PnorSmtdx8DEjdKq5Zi75T8Bqt4DOfWJSsuhTEXTfEYEyL+LdLpdaQE0CMVv+hKWUHFha76g1R+QKaRf8BP/nvzP+t7rr+1dt5A:211B","UTF8")
    Line9=modBTPrinter.gConv.StringToBytes("^FT438,73^A0N,45,45^FH\^FDFecha:^FS","UTF8")
    Line10=modBTPrinter.gConv.StringToBytes("^FT572,73^A0N,45,45^FH\^FD" & fechahoy & "^FS","UTF8")
    Line11= modBTPrinter.gConv.StringToBytes("^FT32,153^A0N,39,38^FH\^FDArticulo:^FS","UTF8")
    Line12=modBTPrinter.gConv.StringToBytes("^FT174,153^A0N,39,38^FH\^FD" & Starter.gArticuloDetalle(0) & "^FS","UTF8")
    Line13=modBTPrinter.gConv.StringToBytes("^FT32,200^A0N,39,38^FH\^FDDescripcion:^FS","UTF8")
    Line14=modBTPrinter.gConv.StringToBytes("^FT352,287^A0N,34,33^FH\^FD" & Starter.gArticuloDetalle(3) & "^FS","UTF8")
    Line15=modBTPrinter.gConv.StringToBytes("^FT277,291^A0N,39,38^FH\^FDU/M^FS","UTF8")
    Line16=modBTPrinter.gConv.StringToBytes("^FT33,290^A0N,39,38^FH\^FDCantidad:^FS","UTF8")
    Line17=modBTPrinter.gConv.StringToBytes("^FT32,238^A0N,34,33^FH\^FD" & Desc2 & "^FS","UTF8")
    Line18=modBTPrinter.gConv.StringToBytes("^FT233,194^A0N,34,33^FH\^FD" & Desc1 & "^FS","UTF8")
    Line19=modBTPrinter.gConv.StringToBytes("^FT181,290^A0N,39,38^FH\^FD" & iCantEtiquetas & "^FS","UTF8")
    Line20=modBTPrinter.gConv.StringToBytes("^BY2,3,83^FT30,389^BCN,,N,N","UTF8")
    Line21=modBTPrinter.gConv.StringToBytes("^FD>:" & Starter.gArticuloDetalle(0) & "^FS","UTF8")
    Line22=modBTPrinter.gConv.StringToBytes("^PQ1,0,1,Y^XZ","UTF8")
    
    Log(modBTPrinter.gserial1.OutputStream)
    modBTPrinter.gStrOut = modBTPrinter.gserial1.OutputStream
    
    modBTPrinter.gStrOut.WriteBytes(Line1Byte,0,Line1Byte.Length)
    modBTPrinter.gStrOut.WriteBytes(Line2Byte,0,Line2Byte.Length)
    modBTPrinter.gStrOut.WriteBytes(Line3Byte,0,Line3Byte.Length)
    modBTPrinter.gStrOut.WriteBytes(Line4,0,Line4.Length)
    modBTPrinter.gStrOut.WriteBytes(Line5,0,Line5.Length)
    modBTPrinter.gStrOut.WriteBytes(Line6,0,Line6.Length)
    modBTPrinter.gStrOut.WriteBytes(Line7,0,Line7.Length)
    modBTPrinter.gStrOut.WriteBytes(Line8,0,Line8.Length)
    modBTPrinter.gStrOut.WriteBytes(Line9,0,Line9.Length)
    modBTPrinter.gStrOut.WriteBytes(Line10,0,Line10.Length)
    modBTPrinter.gStrOut.WriteBytes(Line11,0,Line11.Length)
    modBTPrinter.gStrOut.WriteBytes(Line12,0,Line12.Length)
    modBTPrinter.gStrOut.WriteBytes(Line13,0,Line13.Length)
    modBTPrinter.gStrOut.WriteBytes(Line14,0,Line14.Length)
    modBTPrinter.gStrOut.WriteBytes(Line15,0,Line15.Length)
    modBTPrinter.gStrOut.WriteBytes(Line16,0,Line16.Length)
    modBTPrinter.gStrOut.WriteBytes(Line17,0,Line17.Length)
    modBTPrinter.gStrOut.WriteBytes(Line18,0,Line18.Length)
    modBTPrinter.gStrOut.WriteBytes(Line19,0,Line19.Length)
    modBTPrinter.gStrOut.WriteBytes(Line20,0,Line20.Length)
    modBTPrinter.gStrOut.WriteBytes(Line21,0,Line21.Length)
    modBTPrinter.gStrOut.WriteBytes(Line22,0,Line22.Length)
    modBTPrinter.gStrOut.Flush
'    MsgboxAsync("Printed OK","OK")
    ToastMessageShow("Se envió la impresión",True)
'    Line1Byte= modBTPrinter.gConv.StringToBytes("^XA~TA000~JSN^LT0^MNW^MTT^PON^PMN^LH0,0^JMA^PR6,6~SD15^JUS^LRN^CI0^XZ","UTF8")
'    Line2Byte=modBTPrinter.gConv.StringToBytes("^XA","UTF8")
'    Line3Byte=modBTPrinter.gConv.StringToBytes("^MMT","UTF8")
'    Line4=modBTPrinter.gConv.StringToBytes("^PW812","UTF8")
'    Line5=modBTPrinter.gConv.StringToBytes("^LL0406","UTF8")
'    Line6=modBTPrinter.gConv.StringToBytes("^LS0","UTF8")
'    Line7=modBTPrinter.gConv.StringToBytes("^FO0,0^GFA,03072,03072,00024,:Z64:","UTF8")
'    Line8=modBTPrinter.gConv.StringToBytes("eJztVUGOozAQbFvxKOKAiDTc0ZwiH3iD5wdEwn+YQx6Bctpn+Ih8mDfMUzii1cpvmDIYIoVG2r2sVqu0QwilouiubhOiZ/xXkTkeLxserwOPW8vj3v8RX4bQcbiw1rB871m+2uHnIQySwUtrmwODa+99z+AWwTkUEOMWFrTDp8x7x+E7BYQbCmD07TvLl96xBinbsA3Iwxi4Bivbsnxkr7kGl7YtW1Y/1L94vuLsgb7seD6DTvosrnb4GZrL5Q9/BFevDGPOPUFYw9WryXe6rzZ4QSXWtmCNo6bt/LziaHf4Z9rOZ7HDP+O4PuqrJrpzaE1DAmc6mCTupe81JqjHGHWasm7GLxdxaQplwS9RNqmk4/0N/JcwjFR/DnmXz3zRKOT/OuXT4gJ3TCGdhKie8seSTs+4wFr4WMIkX2Un3Rn8D+Q/0FUOaY4UCZP4YnpCKjsjcklfuvjtVv2mgEORb3CffeBDXw7oQj3MeHwzLPoWRpXJnrhxF328JFZ7TuWpWPQnPt35KX/5E2NXfyV9oqVeEaWXbZxN/V3yx++U/2nqb7HyL0v+3cy/TvkTjePiz12/ie144Ef/XWxHz/LV6r+b+dF/WP/yVSc/G0JLIz+uQq0F48WT9VFfO+1d1t3nx8QOtHC+xGedHz3zP+A8XkM15ckgZacOtxhUbDOckkH/WEhJVdX9wA9cuOPbsZpxzJs4GIM/F2wsY8R6w42qdB9afXyjlU9F8Vczf8Yzfje+AUW+ty4=:DF2B","UTF8")
'    Line9=modBTPrinter.gConv.StringToBytes("^FT438,73^A0N,45,45^FH\^FDFecha:^FS","UTF8")
'    Line10=modBTPrinter.gConv.StringToBytes("^FT572,73^A0N,45,45^FH\^FD22/09/2020^FS","UTF8")
'    Line11= modBTPrinter.gConv.StringToBytes("^FT32,153^A0N,39,38^FH\^FDArticulo:^FS","UTF8")
'    Line12=modBTPrinter.gConv.StringToBytes("^FT174,153^A0N,39,38^FH\^FDHAT0149 001000^FS","UTF8")
'    Line13=modBTPrinter.gConv.StringToBytes("^FT32,200^A0N,39,38^FH\^FDDescripcion:^FS","UTF8")
'    Line14=modBTPrinter.gConv.StringToBytes("^FT352,287^A0N,34,33^FH\^FDMILL^FS","UTF8")
'    Line15=modBTPrinter.gConv.StringToBytes("^FT277,291^A0N,39,38^FH\^FDU/M^FS","UTF8")
'    Line16=modBTPrinter.gConv.StringToBytes("^FT33,290^A0N,39,38^FH\^FDCantidad:^FS","UTF8")
'    Line17=modBTPrinter.gConv.StringToBytes("^FT32,238^A0N,34,33^FH\^FDDescripcion2^FS","UTF8")
'    Line18=modBTPrinter.gConv.StringToBytes("^FT233,194^A0N,34,33^FH\^FDDescripcion1^FS","UTF8")
'    Line19=modBTPrinter.gConv.StringToBytes("^FT181,290^A0N,39,38^FH\^FD9999^FS","UTF8")
'    Line20=modBTPrinter.gConv.StringToBytes("^BY3,3,83^FT136,390^BCN,,N,N","UTF8")
'    Line21=modBTPrinter.gConv.StringToBytes("^FD>:HAT>50149>6 >5001000^FS","UTF8")
'    Line22=modBTPrinter.gConv.StringToBytes("^PQ1,0,1,Y^XZ","UTF8")
End Sub


Sub txtCantidad_EnterPressed
    txtEtiquetas.mBase.RequestFocus
End Sub
 

Attachments

  • PrintLabel_TEST.zip
    92.8 KB · Views: 99
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Remove all code /reference for B4XTable1 from Activity_Create.

B4X:
Sub fcnLoadData  
   '..........code
   '...................
    Dim data As List = su.LoadCSV2(Starter.gSQLDataBasePath, CSVFileName, ",", headers)
    B4XTable1.SetData(data)


    '//////////////////////////////////
    Sleep(0)
    B4XTable1.lblFirst.Parent.Visible = False
    B4XTable1.SearchField.TextField.TextSize = 22
    B4XTable1.SearchField.mBase.SetLayoutAnimated(0, 5dip, 0, 200dip, 60dip)
    B4XTable1.Refresh  ' unsure if needed.


Note: This will hide the default navigation buttons.... You will need to add your own customized navigation. (refer code & image in post#6)
 
Upvote 0

joaquinortiz

Active Member
Licensed User
Longtime User
Remove all code /reference for B4XTable1 from Activity_Create.

B4X:
Sub fcnLoadData 
   '..........code
   '...................
    Dim data As List = su.LoadCSV2(Starter.gSQLDataBasePath, CSVFileName, ",", headers)
    B4XTable1.SetData(data)


    '//////////////////////////////////
    Sleep(0)
    B4XTable1.lblFirst.Parent.Visible = False
    B4XTable1.SearchField.TextField.TextSize = 22
    B4XTable1.SearchField.mBase.SetLayoutAnimated(0, 5dip, 0, 200dip, 60dip)
    B4XTable1.Refresh  ' unsure if needed.


Note: This will hide the default navigation buttons.... You will need to add your own customized navigation. (refer code & image in post#6)
Thanks @mangojack it works...thanks for your time. sorry for my misunderstanding on post #7.

Yes. you are right!...the size of the SearchField, can't increase the size.
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
Yes. you are right!...the size of the SearchField, can't increase the size.

I managed to increase the height of the SearchField . I have re positioned the SearchField and used custom navigation buttons at the bottom of Table.
An improvement but still needs a bit of tinkering etc.


Screenshot_B4XTable.png
 

Attachments

  • B4XTable Search Nav Example.zip
    62.6 KB · Views: 130
Last edited:
Upvote 0

joaquinortiz

Active Member
Licensed User
Longtime User
Dear @mangojack

Great Job!!!!....your a genius!....Thanks a lot for your commitment!

With your sample I adapt my screen as I want....thanks again!
 

Attachments

  • B4XTable4.jpeg
    B4XTable4.jpeg
    89.3 KB · Views: 211
  • B4XTable5.jpeg
    B4XTable5.jpeg
    78.4 KB · Views: 169
Upvote 0

mangojack

Expert
Licensed User
Longtime User
With your sample I adapt my screen as I want....thanks again!

The above example has been updated (post #12). The table was not resizing correctly and entries were missing.
You might want to take another look , as it allows you to have the custom navigation below the table (if you want that)

It is still not perfect but better (IME Height_Changed not handled for one)
 
Upvote 0
Top