ghosh123 has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monk,
Suppose I have a Hlistplus widget with some data in it in some rows and under some column headers. Assume if I want to enter a new set of data in an already existing entryPaths, then how can I do that deleting the existing data in those rows.
while doing that I am getting following error :
XS_Tk__Callback_Call error:element "0" already exists at /user/perl_5.8.8/lib/Tk.pm line 250.
XS_Tk__Callback_Call: Command not found.
I am just copy/pasting a sample code here :
use Tk; use HListplus; my $mw = MainWindow->new(); # CREATE HEADER STYLE 1 my $headerstyle1 = $mw->ItemStyle( 'window', -anchor => 'nw', -pady => -10, -padx => 10, ); # CREATE MY HLIST my $hlist = $mw->Scrolled( 'HListplus', -scrollbars => 'oe', -columns => 2, -header => 1, -width => 40, -headerstyle => $headerstyle1, )->pack( -side => 'left', -expand => 'yes', -fill => 'both' ); # CREATE HEADER STYLE 2 my $headerstyle = $hlist->ItemStyle( 'window', -anchor => 'nw', -pady => 0, -padx => 10, ); $hlist->header( 'create', 0, -itemtype => 'resizebutton', -style => $headerstyle, -text => 'Test Name', -activebackground => 'white', ); $hlist->header( 'create', 1, -itemtype => 'resizebutton', -style => $headerstyle, -text => 'Status', -activebackground => 'white', ); my $red = $hlist->ItemStyle( 'text', -foreground => '#800000', -background => 'white' ); my $blue = $hlist->ItemStyle( 'text', -foreground => '#000080', -anchor => 'e', -background => 'white' ); foreach ( [ Joe => '$10,000' ], [ Peter => '$20,000' ], [ Raj => '$90, 000 something to make it very much wider' ], [ Zinh => '$0' ] ) { my $e = $hlist->addchild(""); $hlist->itemCreate( $e, 0, -itemtype => 'text', -text => $_->[0], -s +tyle => $red ); $hlist->itemCreate( $e, 1, -itemtype => 'text', -text => $_->[1], -s +tyle => $blue ); $hlist->selectionClear(); } Tk::MainLoop;
All I want to know is, if at a later point of time using this same $hlist object how can I enter a new set of data in the 0th and 1st entrypath instead of the existing Joe->$10,000 and Peter->$20,000
Thanks
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to configure a HListplus widget
by zentara (Archbishop) on Feb 21, 2013 at 12:20 UTC | |
Re: How to configure a HListplus widget
by Anonymous Monk on Feb 21, 2013 at 08:13 UTC | |
by ghosh123 (Monk) on Feb 21, 2013 at 08:24 UTC | |
by Anonymous Monk on Feb 21, 2013 at 08:27 UTC | |
by ghosh123 (Monk) on Feb 21, 2013 at 08:57 UTC | |
by marto (Cardinal) on Feb 21, 2013 at 09:03 UTC | |
by Anonymous Monk on Feb 21, 2013 at 09:27 UTC |