arunmep has asked for the wisdom of the Perl Monks concerning the following question:

hello monks iam creating windows dynamically by a click of a button the window has a single scrolled widget. iam adding text to the scrolled widget dynamically each time. but the contents are getting concatenatd to the scrolled widget across windows
this is my code


open(testhandle,"<$file1") or die("unable to open the file"); $mw = MainWindow->new( -title => "hyperlinks" ); $t = $mw->Scrolled('Text')->pack(-expand=>'y',-fill=>'both'); $tag = "tag000"; while($filedata=<testhandle>) { push(@testdata1,$filedata); } foreach $test(@searcharray) { foreach (@testdata1) { $i=1; @searcharrytest=split(/$test/); foreach $searchkey(@searcharrytest) { if(($i%2)==0) { $t->insert( 'end', $test, $tag ); $t->tagConfigure( $tag, -foreground => 'red' ); $tag++; $i=1; } $t->insert( 'end', $searchkey ); $i=2; } } }

please tell me a way to clear the contents of the scrolled widget

Edit: g0n - added code tags

Replies are listed 'Best First'.
Re: problem with scrolled wigets
by spiritway (Vicar) on Jan 12, 2006 at 06:06 UTC