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?
Data Grid - set the bg colour of a text chunk
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Data Grid - set the bg colour of a text chunk
Hi James,
Try this:
...
set the backgroundcolor of word 5 of field "the_results" OF ME to 246,154,62
...
Best
Klaus
probably another "of me"jameshale wrote:What am I missing?

Try this:
...
set the backgroundcolor of word 5 of field "the_results" OF ME to 246,154,62
...
Best
Klaus
Re: Data Grid - set the bg colour of a text chunk
yes.
I can see I need to not be so quick to ignore me in my coding
Thanks again.
James
I can see I need to not be so quick to ignore me in my coding

Thanks again.
James
Re: Data Grid - set the bg colour of a text chunk
Hi James,
I only knew cause i was hit by this some time ago, too
Best
Klaus
I only knew cause i was hit by this some time ago, too

Best
Klaus