Android Question [Solved] How do I "mark" a row of a B4Xtable with a background color?

Sergio Castellari

Active Member
Licensed User
Situation:

A) I have a B4XTable view
B) I need that by clicking on any of the columns, I can change the background color of the entire row.

Basically what I want is for the USER to see which row was selected, showing it in another color.

Greetings
 
Solution
Basically what I want is for the USER to see which row was selected, showing it in another color.
The easiest way Sergio is to use the extension class to B4XTable. Here is the link:
You would choose in your case: SINGLE_LINE_PERMANENT - selection of a single line.
B4X:
XSelections.Mode = XSelections.MODE_SINGLE_LINE_PERMANENT
    XSelections.SelectionColor=xui.Color_Green     'you can change the color of the row selected with this

Mahares

Expert
Licensed User
Longtime User
Basically what I want is for the USER to see which row was selected, showing it in another color.
The easiest way Sergio is to use the extension class to B4XTable. Here is the link:
You would choose in your case: SINGLE_LINE_PERMANENT - selection of a single line.
B4X:
XSelections.Mode = XSelections.MODE_SINGLE_LINE_PERMANENT
    XSelections.SelectionColor=xui.Color_Green     'you can change the color of the row selected with this
 
Last edited:
Upvote 3
Solution

Sergio Castellari

Active Member
Licensed User
Hello there @Mahares

I have followed your suggestions
Look at my surroundings:


I think I have the correct libraries, however it doesn't recognize "B4XTableSelections"
What I can be doing wrong?
Download this example (and it works!):

Greetings and thanks!
 
Upvote 0

Sergio Castellari

Active Member
Licensed User
UPS!!!!
My ignorance believed that it was included in "B4XCollections"
Adding "B4XTablesSelections.bas" came out working !!!!
It is also necessary to clarify that the following must be done (in addition to what you indicate above):

B4XTable1_DataUpdated:
Sub B4XTable1_DataUpdated
...
    XSelections.Refresh
End Sub
Refresh the display when we change pages

B4XTable1_CellClicked:
Private Sub B4XTable1_CellClicked (ColumnId As String, RowId As Long)
    XSelections.CellClicked(ColumnId, RowId) : Sleep(150)
...
End Sub
and we paint the row when selecting it

A million THANKS @Mahares
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…