Highlighting in realtime (guitar chords)
Posted: Tue Jan 17, 2006 6:42 pm
Using TRichViewEdit :
I need to highlight all the keywords I specify in an array (say, 'Hm', 'Am', 'C7', 'D#','Em','C'...). Something you provided in your MultiDemo (7.Search & Mark). BUT...
1) I need it to be done in real time (as one writes or paste, that is changes the
document) and not after one clicks a button (I think onchange event could do?)
2) I would like to un-highlight a word if it doesn't match any of my keywords anymore. For example:
One writes:
C Hm Em Am
Yesterday all my troubles seemed so far away...
as he types the above words which are actually chords (c, Hm, Em, Am) are highlighted because they are in my array of keywords. But then he make a change...
AC Hma Em Am
Yesterday all my troubles seemed so far away...
Then 'AC' and 'Hma' should be unhighlighted immediately in real time as they are not in
my array.
And besides, I have troubles with returning the caret to the position it had been before
one started to enter words. The caret seems to be prone to 'run' to the beginning or to
the end of the document. The caret should stay on the same position the user put it or at the end of the document if a text was pasted in RichView.
I hope I made myself clear? Please, help me!
I need to highlight all the keywords I specify in an array (say, 'Hm', 'Am', 'C7', 'D#','Em','C'...). Something you provided in your MultiDemo (7.Search & Mark). BUT...
1) I need it to be done in real time (as one writes or paste, that is changes the
document) and not after one clicks a button (I think onchange event could do?)
2) I would like to un-highlight a word if it doesn't match any of my keywords anymore. For example:
One writes:
C Hm Em Am
Yesterday all my troubles seemed so far away...
as he types the above words which are actually chords (c, Hm, Em, Am) are highlighted because they are in my array of keywords. But then he make a change...
AC Hma Em Am
Yesterday all my troubles seemed so far away...
Then 'AC' and 'Hma' should be unhighlighted immediately in real time as they are not in
my array.
And besides, I have troubles with returning the caret to the position it had been before
one started to enter words. The caret seems to be prone to 'run' to the beginning or to
the end of the document. The caret should stay on the same position the user put it or at the end of the document if a text was pasted in RichView.
I hope I made myself clear? Please, help me!