Yes, but you're probably not going to like it. Without hacking the C source code, the best workaround I've found in the past is to add 1 more column than you expect to have within the HList. The end result is close to what you will see on similar Windows controls.

Set -columns to 3, and ignore that extra column when populating the HList.

Update: Also try setting -padx values in the styles to 0.

Update Again: Ok, the only problem I see of adding that additional column (that you don't intend to use), is the fact that you'd probably like to be able to resize column 1, now, but you can't. The author has set the widget up so that the last header you create will not be allowed to resize -- I can see how this makes a kind of sense, assuming that you are always going to make resizable headers for all of our headers.

A better approach would have been to check the total number of columns defined for the HList and to determine which column the resizebutton was being created for before deciding whether or not to allow the resize bar. This can be fixed easily by going to line 362 or so within the source, and just after the comment:

    # Create a new Resize Button

Add the following two lines:

my $lastCol = 0; $lastCol = 1 if $this->cget(-columns) == ($column + 1);

And then, a few lines below where the HeaderResizeButton is being created change the -lastcolumn option to:

-lastcolumn => $lastCol,

I'll submit the patch to the Author and see if he'll take it. That's it for updates to this node...

Rob

In reply to Re: Binding columns in Tk::Hlist by rcseege
in thread Binding columns in Tk::Hlist by jdtoronto

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.