Android Question B4XTable-Typed Characters in Search Box. Their Color does not Change in Columns Found Data

Mahares

Expert
Licensed User
Longtime User
When characters are typed in the B4XTable search box and they make a match in any given column data, normally the color of those characters display with a different color, but for some of my apps, the color does not change in the column data. I tried changing the placement of a Sleep(0) in the code, but that did not help. I thought, perhaps a theme color , but not so.
Thank you
 

elsanto

Member
Licensed User
Longtime User
Hello, from version 1.21 of B4XTable you have to put true
B4XTable1.HighlightSearchResults = True
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
B4XTable1.HighlightSearchResults = True
The highlight defaults to TRUE by default, but I have inserted that line anyway and it did not seem to make a difference. The highlight does not change color, although it filters. I even put it in many places in the code to see if it matters, but no change. I even added a line to it.
B4X:
B4XTable1.HighlightSearchResults = True
B4XTable1.HighlightTextColor=xui.Color_Blue   'added this line and it makes no difference
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
My project is a B4A project with B4Xpages. I removed all the xSelections features like commenting these 2 lines, then the highlight color started working again. It still filters, but the highlight color does not change.:
B4X:
XSelections.Initialize(B4XTable1)
XSelections.Mode = XSelections.MODE_SINGLE_LINE_PERMANENT
I was using xSelections class 1.04, B4Xtable 1.21
I think the B4J example in this link may have the same problem, although B4J was not my focus:
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
Best if you are able to reproduce it in a small project.
Here is a project attached that demonstrates the behavior in B4A. Try to search, you will see that the highlight color does not change. However, if you comment all the lines pertinent to xSelections, it works.
 

Attachments

  • B4XTablexSelections021421.zip
    28.3 KB · Views: 140
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Search highlighting is disabled automatically based on the selected mode.

You can disable by making this change:
B4X:
Public Sub setMode (m As Int)
    mCurrentMode = m
    SelectedLines.Clear
    If mCurrentMode = MODE_SINGLE_CELL_TEMP Then
        mTable.SelectionColor = SelectionColor
        mTable.HighlightSearchResults = True
    Else
        mTable.SelectionColor = xui.Color_Transparent
        mTable.HighlightSearchResults = Not(xui.IsB4J) '<----- line 107 in B4XTableSelections
    End If

I haven't tested it enough so not ready to update the library.
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I haven't tested it enough so not ready to update the library.
Sorry. It does not work. It does not highlight the selection. I can live without it. You are too busy for something which is not essential like this. Please note that it does not work either in your B4J example I made reference to in post #4 if you use for instance: XSelections.MODE_SINGLE_LINE_PERMANENT
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
You can enable it on B4A
No. Search highlighting does not work in B4A even with the change you instructed me to make. Try it in my example after you implement the change you made in the class and test for yourself after you choose: XSelections.MODE_SINGLE_LINE_PERMANENT
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1613308043297.png
 

Attachments

  • Project.zip
    28.3 KB · Views: 138
Upvote 0

Mahares

Expert
Licensed User
Longtime User
I wasn't clear
Looking at the xSelections class module change you made by commenting the below code to make it work, but now the problem is: the selection color blinks and disappears and does not stay on and the text color is barely visible on when you choose: XSelections.MODE_SINGLE_LINE_PERMANENT
B4X:
If mCurrentMode = MODE_SINGLE_CELL_TEMP Then
        mTable.SelectionColor = SelectionColor
        mTable.HighlightSearchResults = True
    Else
        mTable.SelectionColor = xui.Color_Transparent
        mTable.HighlightSearchResults = False  
    End If
 
Upvote 0
Top