infiniti35
Technical User
Hi all,
I have a script that takes the string input and displays on the text widget. What I want to do is to set up a tag when the string input contains a special word such as "ERR". I want to highlight the entire line which contains this special word. How do I find the position index of this line in the text widget and set up tag.
Thanks everyone!!
Here is a sample code:
proc append_text {widget text}
{
if [ regexp "ERR" $text ] {
$widget insert end $text
....
set up tag for this line and highlight it
....
}
else {
$widget isnert end $text
}
}
I have a script that takes the string input and displays on the text widget. What I want to do is to set up a tag when the string input contains a special word such as "ERR". I want to highlight the entire line which contains this special word. How do I find the position index of this line in the text widget and set up tag.
Thanks everyone!!
Here is a sample code:
proc append_text {widget text}
{
if [ regexp "ERR" $text ] {
$widget insert end $text
....
set up tag for this line and highlight it
....
}
else {
$widget isnert end $text
}
}