in reply to Tk::Text Validation

To elaborate a bit on eibwen's reply, the answer depends on what you mean by "actually contains text". Given that you have the full text content (if any) from the widget stored in $data, you just need to choose what conditions are necessary and sufficient -- pick some condition like:
$data =~ /\S/ # must contain a non-whitespace character $data =~ /\w/ # must contain an alphanumeric character length( $data ) > $minlength # must be at least this long
I'm sure you can come up with others that are more relevant to your needs. The point is to apply the test to $data, not to the widget.

Replies are listed 'Best First'.
Re^2: Tk::Text Validation
by willyyam (Priest) on Apr 21, 2005 at 04:00 UTC

    I ended up having to go with a length() test, because none of the other tests (!?) are true for an empty Text field from a TK widget. Who knew? Thanks for your help, and that's why I was looking for new ideas - mine weren't working.