Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3688

Changing the Color of a Single Character In a TextArea string

$
0
0

I need to highlight a single character in a desktoptextarea string depending on where the cursor is in a canvas. I thought it would be easy to make all the characters the same color (green) then make the selected one (As indicated by the variable SelectedPeptideIndex) black, and put that code in the MouseMove handler of the canvas. Nope. The correct character gets a grayish surround, but only the next to last character ever changes color. And the text area blinks incessantly.

For I = 1 To Len( MutatingPeptideTextArea.Text )
MutatingPeptideTextArea.TextColor = RGB( 0 , 210 , 0 )
If Mutations.SelectedPeptideIndex = I - 1 Then
MutatingPeptideTextArea.SelectionStart = Mutations.SelectedPeptideIndex - 1
MutatingPeptideTextArea.SelectionLength = 1
MutatingPeptideTextArea.SelectionTextColor = RGB( 0 , 0 , 0 )
End if
Next

Any suggestions would be welcome.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 3688

Trending Articles