B4J Question B4XTable- Display ProgressBar Values On each ProgressBar Graph Using DDD


Licensed User
Longtime User
The attached project is basically Erel's code with the exception of 3 lines I added in the B4XTable1_DataUpdated sub. I was trying to display the value of each progress bar on the progress bar graph., but the program crashes with the error:
Error occurred on line: 66 (B4XMainPage)
java.lang.RuntimeException: Object should first be initialized (B4XView).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:49)

The referenced link is : https://www.b4x.com/android/forum/t...progress-bar-in-b4xtable?.158192/#post-971491
Thank you


  • B4XTableUsingDDD.zip
    16.5 KB · Views: 55


B4X founder
Staff member
Licensed User
Longtime User
Add the label yourself with the designer, to the "progress" layout. It will be simpler. You can then update it with:
Sub B4XTable1_DataUpdated
    For i = 0 To B4XTable1.VisibleRowIds.Size - 1
        Dim RowId As Long = B4XTable1.VisibleRowIds.Get(i)
        Dim pnl As B4XView = ProgressColumn.CellsLayouts.Get(i + 1) '+1 because the first cell is the header
        Dim progress As B4XView = dd.GetViewByName(pnl, "ProgressBar1")
        Dim lbl As B4XView = dd.GetViewByName(pnl, "Label1")
        lbl.Visible = RowId > 0
        progress.Visible = RowId > 0
        If RowId > 0 Then
            Dim row As Map = B4XTable1.GetRow(RowId)
            progress.Progress = row.Get("Percentage")
            lbl.Text = NumberFormat(row.Get("Percentage"), 0, 0)
        End If
End Sub

Upvote 0