B4J Library [B4X] [XUI] SD FlexGrid (Table)

Star-Dust

Expert
Licensed User
Longtime User
Hello. My B4A test is invalid, please help me to see how to modify it.
You just need to add a little pause after populating the grid.

You find it in the original example. If you heavily populate a grid, he waits half a second before updating the views so that he doesn't have to continually update
B4X:
    Activity.LoadLayout("Layout1")
    Ev.Initialize(FlexGrid1)
    FlexGrid1.ColsName=Array As String("","N","On","Name","Img","Digit")
    FlexGrid1.ColsWidth=Array As Int(75dip,50dip,50dip,100dip,60dip,100dip)
    FlexGrid1.ColsType=Array As Int(FlexGrid1.TypeButton,FlexGrid1.TypeInt,FlexGrid1.TypeCheck,FlexGrid1.TypeString,FlexGrid1.TypeImage,FlexGrid1.TypeFloat)
    FlexGrid1.ColsAlignment=Array As String("CENTER","CENTER","CENTER","LEFT","LEFT","RIGHT")
    
    FlexGrid1.SetColCustomize(0,0xFF5BC17D,xui.Color_RGB(240,240,240),xui.CreateDefaultFont(14))
    FlexGrid1.ActiveCheckBox=False
    
    Dim B As Boolean=False
    For i=1 To 100
        B=Not(B)
        FlexGrid1.AddRow(Array As Object("B" &i,i,B,"User " & i,Null,Rnd(50,10000)/100),True)
    Next
    
    Sleep(500) ' Add Pause'
    FlexGrid1.ScrollToRow=FlexGrid1.RowCount
 

yuhaowang

Member
thank you so much
 

Star-Dust

Expert
Licensed User
Longtime User
Update rel 0.06
Add method: ColCount as int [read only]​
 

Star-Dust

Expert
Licensed User
Longtime User
Update 0.07

Now if a cell is defined as a string it also accepts CSBuild (both in android and iOS)

NB. The examples with have also been updated
 

Star-Dust

Expert
Licensed User
Longtime User
BTW, there is a useful method for this in XUI Views:
B4X:
XUIViewsUtils.SetTextOrCSBuilderToLabel(...)
I just relied on this code

 

yuhaowang

Member
Hello. How can I turn off/on table refresh?

FlexGrid1.visible=false
.....
FlexGrid1.visible=true


FlexGrid1.Redraw=false
.......
FlexGrid1.Redraw=True

??????????????????????
 

Star-Dust

Expert
Licensed User
Longtime User
Update 0.08
if a cell is defined as a Button it also accepts CSBuild (both in android and iOS)
Fix Bugs ClearRow​
 

sn_nn

Member
Licensed User
Longtime User
Hello, Star-Dust! Your FlexGrid is very usable. From ver 0.07 char sequenses are supported.
But 2 small thinks are missing... :
1. Not supported clickable words by csbuilder in the cells
2. I can't clear selection for cells, something like this:
B4X:
UnselectCell(Row,Col)

May be it's possible to do by another way?
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
You can delete the selection
B4X:
SD_FlexGrid1.ClearSelection
 

Sabotto

Active Member
Licensed User
FlexGrid Example is not responding. Do you want to close it?
This msgbox appears as soon as I click on a checkbox in the list.
I click on it, it removes the tick, but from that moment on it no longer responds to commands (scrolling, etc.) and after 3-4 seconds the message appears.
Can you tell me why? Or check if it's just my problem?
The only thing I have changed (for testing purposes) is to set the column width "Name" to 400

B4X:
FlexGrid1.ColsWidth=Array As Int(75dip,50dip,50dip,400dip,60dip,100dip)
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
I'll do some tests.
Please use the English language in this forum space
 

Star-Dust

Expert
Licensed User
Longtime User
Update 0.09
Fixed bugs on checkbox​
 

Sabotto

Active Member
Licensed User
I take this opportunity to report this other little bug to you too (unfortunately I am only suffering from it now ..) Intellisense suggests using the "SetCellValue" method incorrectly (I assume it used to be a property ..)
 

Sabotto

Active Member
Licensed User
thanks a lot.
Other two questions
1) If I want to change only the text color of a cell, leaving everything else unchanged (backgrund color, font type and size, etc.) it is possible to do ?
example
B4X:
FlexGrid1.SetCellCustomize (r, c, xui.Color_Blue, xui.Color_Yellow, xui.CreateDefaultBoldFont (16))
'suppose I only want to change xui.Color_Blue to xui.Color_Green, do I have to rewrite the whole statement with all parameters which will not be touched?
Or I can do something like
B4X:
CellTetxtColor (r, c) = xui.Color_Green

2) How do I access the font type and size of a given cell?
 

Star-Dust

Expert
Licensed User
Longtime User
only this:
B4X:
FlexGrid1.SetCellCustomize (r, c, xui.Color_Green, xui.Color_Yellow, xui.CreateDefaultBoldFont (16))
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…