Android Question Resize Columns According to Content inside the cell column of B4X Table

RishiKumar2210

Active Member
B4X:
Dim f As B4XFont = it_daybooklist.LabelsFont
    For i = 0 To it_daybooklist.VisibleRowIds.Size - 1
        Dim p As B4XView = accountname_col.CellsLayouts.Get(i+1)
        Dim b4xlbl As B4XView= p.GetView(0)
        If b4xlbl.Text.Length > 50 Then
            b4xlbl.Font = ix_xui.CreateDefaultFont(12)
        Else
            b4xlbl.Font = f
        End If
    Next

Here accountname_col is my column's b4xtablecolumn and it_daybooklist is my b4x table name.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Here accountname_col is my column's b4xtablecolumn and it_daybooklist is my b4x table name.
@zed asked you to attach your project, o a small project not a code snippet. The code you posted is not sufficient. to help you. Can you do that. You get better results when you cooperate with members' requests.
 
  • Like
Reactions: zed
Upvote 0

epiCode

Active Member
Licensed User
At some point or other all of us deal with a common challenge: Fitting lots of information on a small screen.

As you work with tables containing a lot of data and limited space, it gets harder. To handle this, it's a good idea to show only the most important information in small columns. If there's more to see, you can use "..." to indicate that, and users can see the full text when they tap or click.

But if text length in your columns vary too much and it's vital to show everything, the b4xtable might not be the best choice for you. Create a custom screen to show your information in that case.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I have to resize the HEIGHT(Not Width) of column according to content in the column.
Since you are not going to or not able to post a project to help you further, as suggested by @zed in post #15, here is the code you would need to click on a cell that has too long of a text to see it all. This code will allow you to see the entire text: Just add this sub to your project:
B4X:
Private Sub B4XTable1_CellClicked (ColumnId As String, RowId As Long)
     Dim m As Map = B4XTable1.GetRow(RowId)
    MsgboxAsync(m.Get(ColumnId), "Full company name")
End Sub
 
Upvote 0

RishiKumar2210

Active Member
Since you are not going to or not able to post a project to help you further, as suggested by @zed in post #15, here is the code you would need to click on a cell that has too long of a text to see it all. This code will allow you to see the entire text: Just add this sub to your project:
B4X:
Private Sub B4XTable1_CellClicked (ColumnId As String, RowId As Long)
     Dim m As Map = B4XTable1.GetRow(RowId)
    MsgboxAsync(m.Get(ColumnId), "Full company name")
End Sub
Thanks Mahares
 
Upvote 0
Top