Hi
I have HList tree with three columns and ten rows.
After launching the gui, I want to change the value of one column
randomly (after every 2,3 or 5 secs). Maximum interval would be 5 but not more than that.

Following is my code, please help me with the last part .
The gui should get launched first. And then every 2,3 or 5 sec the value should start getting changed.
Never mind the values of the cells.

use strict; use warnings; use Tk; use Tk::HList; use Tk::ItemStyle; my $mw = MainWindow->new(); my $hlistframe = $mw->Frame()->pack(-fill=> 'both', -expand => 1); my $font = "{helvetica} -12 bold"; my $hl = $hlistframe->Scrolled('HList', -scrollbars => 'ose', -columns =>7 , -header => 1, -width => 50, -command => sub {print "AAA\n";}, )->pack(-fill => 'both',-expand =>1 ); my $name = $hl->Label(-text => "Name", -anchor => 'w',-font => $font); $hl->headerCreate(0,-itemtype => 'window',-widget => $name) ; my $DOB = $hl->Label(-text => "DOB", -anchor => 'w',-font => $font); $hl->headerCreate(1,-itemtype => 'window',-widget => $DOB); my $Address = $hl->Label(-text => "Address", -anchor => 'w',-font => +$font); $hl->headerCreate(2,-itemtype => 'window',-widget => $Address); my $style1 = $hl->ItemStyle('text', -selectforeground =>'black', -an +chor =>'nw',-background =>'green',-font => $font); my $style2 = $hl->ItemStyle('text', -selectforeground =>'black', -an +chor =>'nw',-background =>'red',-font => $font); &populate(); sub populate { my $path = 0; foreach my $entry (1 .. 10) { insertData($path,$entry); $path++; } } sub insertData { my ($path,$entry) = @_; $hl->add($path); $hl->itemCreate($path,0,-text => "thomas"); $hl->itemCreate($path,1,-text => "20-10-2000"); $hl->itemCreate($path,2,-text => "102 street" , -style => $style1); } =cut # please help me with how to change value of two cells randomly while(rand) { $hl->itemConfigure( 2, 2, -text => "202 street", -style => $style2 ); $hl->itemConfigure( 3, 2, -text => "202 street", -style => $style2 ); } =cut MainLoop;

In reply to How to change a Hlist column value randomly by ghosh123

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.