Hightlight a textarea?

BlitzMax Forums/BlitzMax GUI Programming/Hightlight a textarea?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

How can I do that?
I tryed to write some code that looks like this
Local txt:String = TextAreaText(ScriptEditTA)
					txt = txt.ToLower()
					For Local i:Int = 0 To KeyWords.Length - 1
						Local lp:Int = -1
						Local KW:String = KeyWords[i].ToLower()
						lp = txt.Find(KW, lp + 1)
						While(lp >= 0)
							Local l:Int = Len(KW)
							SetTextAreaText(ScriptEditTA, KeyWords[i], lp, l)
							FormatTextAreaText(ScriptEditTA, 0, 0, 255, TEXTFORMAT_BOLD, lp, l)
							lp = txt.Find(KW, lp + 1)
						Wend
					Next

but if I write something it colors all the words after that keywords.