Let's say I have a text field with "I like red color", is possible just highlight the word "red' in red color instead of making the whole text in red color?
@DonBakke I had tried SELECTION before but it didn't work, after setting the whole text then I used: set_property(ctrlID, "8:@fm:3 ", "SELECTION") set_property(ctrlID, "RED", "FORECOLOR")
Hopefully the content of the text field will allow you to be a little creative. Are you aware of what is actually going to be the text as in are there a limited number of possibilities? If so, are they all similar in content?
If you are aiming for something like I like red colour I like blue colour I like yellow colour where just the one word is changing colour, use three separate text fields. One text field will always display "I like", then a separate text field in the middle for the actual coloured word and then a third text field with the word "colour". So you only need change the forecolor of the middle text field
@AusMarkB I can't do that because there are two many combinations, I just gave the example to simplify my question, in reality , I have to create more than 50 different text fields if I do it in that way, thats why I want to change partial content
@slowjams - Your original post was confusing because highlighting normally means selecting in OI, thus I missed the requirement to color code the highlight. I'm now a bit more confused because you referenced the FORECOLOR property, which doesn't highlight at all but only changes the color of the text.
There really isn't a way to do what you want. You can highlight (via the SELECTION property) or you can make specific text a certain color by using an RTF textbox and formatting the content appropriately.
Comments
I had tried SELECTION before but it didn't work,
after setting the whole text then I used:
set_property(ctrlID, "8:@fm:3 ", "SELECTION")
set_property(ctrlID, "RED", "FORECOLOR")
it still set the whole sentence in red color
Are you aware of what is actually going to be the text as in are there a limited number of possibilities?
If so, are they all similar in content?
If you are aiming for something like
I like red colour
I like blue colour
I like yellow colour
where just the one word is changing colour, use three separate text fields.
One text field will always display "I like", then a separate text field in the middle for the actual coloured word and then a third text field with the word "colour".
So you only need change the forecolor of the middle text field
I can't do that because there are two many combinations, I just gave the example to simplify my question, in reality , I have to create more than 50 different text fields if I do it in that way, thats why I want to change partial content
There really isn't a way to do what you want. You can highlight (via the SELECTION property) or you can make specific text a certain color by using an RTF textbox and formatting the content appropriately.