I also have the same code for when a file is saved, to update the new text. I would like to able to color the text as it is input though. Would this be possible? Would any of the existing code to color commented string be of any help in doing so? I know of a way I can color the code by splitting the string on each character input but do not know how to monitor the textbox for character input. Any ideas?my $browse = $t->getOpenFile(-title => "Browse For A File!"); if ($browse) { $t->delete("1.0", "end"); $status->delete("1.0", "end"); if (!open(TARGET, "$browse")) { $info = "Error!"; $status->insert("end", "ERROR: Could not open $browse\n"); return; } $line_count = 1; $filename = $browse; my @ext = split(/\./, $filename); my $ext = "\." . $ext[1]; $info = "Loading file '$filename'..."; while (<TARGET>) { #$t->insert("end", "$line_count "); $t->insert("end", $_); if ($ext eq ".pl") { if ($_ =~ /\#/) { my @comment = split(//, $_); my $i = 0; foreach my $comment (@comment) { my $range = length($_); if ($comment eq "#") { my $offset = "$line_count\.$i"; my $end = "$line_count\.$range"; $t->tagAdd("orange", $offset, $end); }else{ $i++; } } } } $line_count++; } }
In reply to Tk Scrolled textbox, parse on input? by Elijah
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |