Bug? B4XTable not showing if Form is maximised

madru

Active Member
Licensed User
Longtime User
Morning,

I have issue with B4XTables where the Form is maximized (or full screen on OSX), sometimes the rows are not displayed only a 'click' within does help to show them. The '1 to xx out of xxxxx' label shows the right value(s) but the table is empty.

any ideas?

this behaviour is only visible if the form is maximised and the anchors are set to left/right & top/button
 

madru

Active Member
Licensed User
Longtime User
sure, not much to see

setting the App into fullscreen and request data from a DB



after click into the table

 

madru

Active Member
Licensed User
Longtime User
something like this does not help

B4X:
    B4XTable1.SetData(Data)
    Sleep(0)
    B4XTable1.mBase.Top=B4XTable1.mBase.Top-1
    Sleep(0)
    B4XTable1.mBase.Top=B4XTable1.mBase.Top+1
    Sleep(0)
    B4XTable1.RefreshNow
 

madru

Active Member
Licensed User
Longtime User
well, I can not really share the code as it is useless due to the database access....

here are two examples

loading a CSV and display that data in the table does always work (I tested this ~200 times and it failed once)

loading from a database fails all the time

B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private xui As XUI
    Private Button1 As B4XView
    Private B4XTable1 As B4XTable
    Private const CSVFileName As String = "test.csv"
    Private su As StringUtils
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1")
    MainForm.Show

End Sub

Sub Button1_Click
    'this works to 99% always shows the data
    Dim header As List
    header.Initialize
    If File.Exists(File.DirApp, CSVFileName) Then
        Dim data As List =su.LoadCSV2(File.DirApp, CSVFileName, ",",header)
    End If
    For i = 0 To 13
        B4XTable1.AddColumn(header.Get(i), B4XTable1.COLUMN_TYPE_TEXT)
    Next
    B4XTable1.SetData(data)
End Sub


Sub Button2_Click
'this fails all the time
    Wait For (GetTestData(mydate,myitem)) Complete (data As List)
    B4XTable1.SetData(data)
    B4XTable1.RefreshNow

End Sub

Sub GetTestData (date As Object,item As String)
    Dim Data As List
    Data.Initialize
    Dim req As DBRequestManager = CreateRequest
    Dim cmd As DBCommand

    cmd = CreateCommand("selectItems", Array As Object(date,item))
   
    Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone (j As HttpJob)
    If j.Success Then
        InitTable (0)
        req.HandleJobAsync(j, "req")
        Wait For (req) req_Result (res As DBResult)
        For Each row() As Object In res.Rows
            Dim s As String = row(0)
            If s.Length=10 Then s=s&"000"
            row(0)=s
            Data.Add(row)
        Next
    Else
        Log("ERROR: " & j.ErrorMessage)
    End If
    j.Release
    Return Data
End Sub
 

rosippc64a

Active Member
Licensed User
Longtime User
I experienced the same from a postgres database. One new click or reloading the query do pass the problem and shows the table data, but interesting that happen only one form of about 20, so may I do something wrong...
 

madru

Active Member
Licensed User
Longtime User
It doesn't matter where the data come from. Something else causes it.

Without a project that reproduces it, I cannot say more.

OK, I can send you a PM with the test code and access to the customer test DB. Do you want to have look?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The end of the sub should look like this:
B4X:
        Case 12
            CreateBarData
            Barchart1.Visible = True
            Pane1.Visible = True
            Return
        Case Else
            Wait For (GetInspection(Null,cbLackVariante.SelectedItem)) Complete (Data As List)
    End Select
    Wait For (B4XTable1.SetData(Data)) Complete (done As Boolean)
    B4XTable1.clvData.Base_Resize(B4XTable1.clvData.AsView.Width, B4XTable1.clvData.AsView.Height)
End Sub
 

madru

Active Member
Licensed User
Longtime User
OK, you are right. Having just those lines will solve the problem.

will do some more testing
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…