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

Hi
Anyone knows how to toggle the image displayed on corner of Column once the sort is complete. Tk has this module called Tk::Column which provide Columnated GUI to work with tabels, but I am unable to change the images (up and down) once the sort (button press on column head) is complete.

Replies are listed 'Best First'.
Re: Tk Columns
by jdporter (Paladin) on Jul 07, 2005 at 14:11 UTC
    If you're using -sort rather than -buttoncommand (and unfortunately, Tk::Columns appears not support both simultaneously), then you're out of luck. You might consider using an icon that suggests sort in either direction, e.g. an "up/down" arrow of some kind.

    Otherwise, you could try using -buttoncommand rather than -sort, but that gets a whole lot more complicated because then you have to write the code that does the sort.

      Thanks for the idea. But I didnt have to write SortCommand again. I just did the following
      '-buttoncommand' => sub {
      $main::oldimage = $_[0]->cget (-image);
      $_[0]->configure (-image => $main::newimage);
      $main::newimage = $main::oldimage;
      $_[0]->SortColumn;
      }