Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Problem in row deletion with Tk::Table

by emilbarton (Scribe)
on Aug 30, 2013 at 07:12 UTC ( #1051557=note: print w/replies, xml ) Need Help??


in reply to Re: Problem in row deletion with Tk::Table
in thread Problem in row deletion with Tk::Table

For instance:
UPDATE: see the 'standalone' example below.
  • Comment on Re^2: Problem in row deletion with Tk::Table

Replies are listed 'Best First'.
Re^3: Problem in row deletion with Tk::Table
by Anonymous Monk on Aug 30, 2013 at 07:47 UTC
    I had a look at csgrouper.pl, sorry, that is way too much code (7k lines). Here is the idea
    #!/usr/bin/perl -- use strict; use warnings; use Tk; my $mw = tkinit; my $Section_tblw = $mw->Table( ... 20 lines or less MainLoop;

    If you can get it down to 20 lines + boilerplate, we might make some progress

      Here's your standalone:
      UPDATE: using choroba's solution in Table constructor, doesn't change the issue.
        You seem to not define the number of rows for the table, so it defaults to 10. If you call clear, only the first 10 lines are deleted. Add
        -rows => 100

        to the table constructor parameters and everything works.

        BTW, you can chomp @vals and push @rows, \@vals.

        لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

        :) Ignoring all the issues with your code with short-circuit

        sub section_del { return $Section_tblw->clear;
        looks like Tk::Table is not deleting checkboxes

        so I replace that with  return my_clear( $Section_tblw ); and one or three dd-Dumper-ings later, its an off-by-one error in clear

        sub my_clear { my $self = shift; my $rows = $self->cget( -rows ); my $cols = $self->cget( -columns ); ## 1st row is labels foreach my $r ( 1 .. $rows ) { #~ foreach my $c ( 1 .. $cols ) { ## 1st column is 1st column foreach my $c ( 0 .. $cols ) { my $old = $self->get( $r, $c ); next unless $old; $self->LostSlave( $old ); $old->destroy; } } $self->_init; $self->QueueLayout( Tk::Table::_SlaveSize() ); } ## end sub my_clear

        I imagine the OBO error migt stem because at one point the first column in each row might have been a counter (nth row) ...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1051557]
help
Chatterbox?
and the questions are moot...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2017-10-24 02:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (286 votes). Check out past polls.

    Notices?