Data Grid - set the bg colour of a text chunk
Posted: Tue Jul 17, 2012 9:43 am
I am using a Data Grid to list the results of a user search on text.
The results are returned using the FORM Data Grid with a field for each of the section heading (prefix_head), the line number of the found text (line_num) and the line of found text itself (the_results).
I wanted to enhance this by setting the background colour of the actual found text within the line of text returned.
To test this I simply set the background colour of a specific word and had a look.
The FillInData handler looks like this:
on FillInData pDataArray
set the text of field "prefix_head" of me to pDataArray["prefix_head"]
set the text of field "the_results" of me to pDataArray["the_results"]
set the backgroundcolor of word 5 of field "the_results" to 246,154,62
set the text of field "line_num" of me to pDataArray["line_num"]
end FillInData
This should set the background colour of the fifth word in each "the_results" field to an orange.
Well it does and it doesn't.
It seems to only set the colour on every fifth row.
So it works, but only once in five rows.
What am I missing?
The results are returned using the FORM Data Grid with a field for each of the section heading (prefix_head), the line number of the found text (line_num) and the line of found text itself (the_results).
I wanted to enhance this by setting the background colour of the actual found text within the line of text returned.
To test this I simply set the background colour of a specific word and had a look.
The FillInData handler looks like this:
on FillInData pDataArray
set the text of field "prefix_head" of me to pDataArray["prefix_head"]
set the text of field "the_results" of me to pDataArray["the_results"]
set the backgroundcolor of word 5 of field "the_results" to 246,154,62
set the text of field "line_num" of me to pDataArray["line_num"]
end FillInData
This should set the background colour of the fifth word in each "the_results" field to an orange.
Well it does and it doesn't.
It seems to only set the colour on every fifth row.
So it works, but only once in five rows.
What am I missing?