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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.