in reply to Re: perl/Tk and expandable widgets
in thread perl/Tk and expandable widgets

Good suggestion but this still does not solve the issue of fixed size buttons/windows for each category. I was more interested in a way to make these fields expandable by clicking and dragging. I have read through the docs on HList and it does not seem possible to do. Am I missing something or is this just one of those things that perl is not going to be able to do?

Edited:
It seems that Tk::Columns is what I would need to accomplish this.

Replies are listed 'Best First'.
Re^3: perl/Tk and expandable widgets
by zentara (Cardinal) on Jun 09, 2005 at 20:25 UTC
    I would say you are "pushing the edge" of Tk's abilities. My first inclination would be to reconfigure the header buttons after you know how wide they should be. You could scan the column for the widest entry, then reconfigure the header button text to be padded to that width. Maybe you would have to packForget and repack too. Sounds like you need to experiment a bit. :-) You can reconfigure the headers of an HList to be different text, but like I said earlier, you will run into the problems of the -width specification being different amoung different widgets. Maybe if you confine everything to a certain font?

    I'm not really a human, but I play one on earth. flash japh
      This thread is old, but...
      I have used a modified HList I found on CPAN called Tk::HListplus that worked quite well for this problem.,
      It uses (as an example):
      $widget->header('create', 0, -itemtype => 'resizebutton', -text => 'Pa +th');
      It allows you to double click on a header to make the column about 1 character wide (so you can grow it again) and also permits the mouse to grab the right side of the header box to adjust the column width.
      I also don't see a problem with initally having the column the correct size for the contents. I use:
      $widget->columnwidth($column_number,'');
      to make it automatic.
      I would recommend using:
      $widget = $host_box->Scrolled(qw/HListplus -scrollbars osoe/);
      so that you have enough room regardless of the host_box size.
      (1st post)
Re^3: perl/Tk and expandable widgets
by rcseege (Pilgrim) on Nov 04, 2005 at 03:54 UTC
    It seems that Tk::Columns is what I would need to accomplish this.

    Note that Tk::Columns, although a decent widget, suffers from the same memory leak problems as Tk::MListbox, because the problem does't truly originate from either one, but from Tk::Listbox that leaks.

    Both of these widgets tend to do sorts faster than what HList will support, because implementing it in HList involves a call for every cell in the Tabular display, where both Columns and MListbox require two for each column: one to delete all entries, and the second to reinsert the sorted elements. For large numbers of rows, this difference can be significant.

    Of course... that extra boost of speed is small comfort when you are blissfully sorting large amounts of data and leaking memory like crazy...

    Rob