in reply to Text Widget empty string

There is always a newline there in the text widget, that is how it is initialized and you cannot even delete it. If you don't type anything, the length of the content will be 1; if you type something, the length is no longer 1.

use Tk; use Tk::Dialog; use strict; use warnings; my $page1 = MainWindow->new(); my $agency_infotf = $page1 -> Scrolled('Text', -scrollbars=> 'e', -wid +th=> 25, -height=>1)->pack; my $button = $page1->Button(-text => "Click", -command => \&verify)->p +ack(); MainLoop; sub verify { my $agency_info = $agency_infotf->get('1.0', 'end'); if (length($agency_info) == 1){ my$dialog = $page1-> Dialog( -title => 'Alert', -text => "Please Complete ALL the Fields on the First Tab" +, -buttons => [ qw(OK) ]) ->Show(); } }

Replies are listed 'Best First'.
Re^2: Text Widget empty string
by Real Perl (Beadle) on Jul 29, 2005 at 05:48 UTC
    Thank you so much!