in reply to Question regarding focus and Tk

Untested, but I've used similar in real programs:
It looks like the problem is that you're basing your Checkbutton's state on $state instead of \$state.

What you've got there is setting -state to the current value of $state. You probably want to try using:

my $i = $frame1->Checkbutton(..., -state => \$state, ...);

If that doesn't work, you'll need to get fancier and dynamically adjust the state of your Checkbutton with something like the following:

sub setting { $i->configure(-state => (substr($regex, 0, 2) eq 'tr' ? 'disabled' : 'normal' )); }

Note: The above isn't use strict; compliant. To do that, you can just hand a closure coderef that has the right context to your Entry widget, but doing so is left as an exercise to the reader. :-)