Update: Nevermind about DirTree -- it probably isn't what you want, despite appearances to the contrary -- at least, it's not as flexible as I remembered. Of the three I mentioned, probably HList is the best bet. However, it's pretty discouraging after all this time to still find the bindings to be faulty despite several submitted patches... still, if you use "single" selectmode, then browsecmd should work Ok.

Three different developers, three different choices for the widget used for mavigation in the left pane. In addition to looking at Tk::Listbox and Tk::Text, I would also suggest you consider one of the HList widgets (Tk::HList, Tk::Tree, or Tk::DirTree) - Tk::DirTree, in particular.

HList, Tree, and DirTree all feature the -browsecmd option which can be used to define a callback when a user browses through entries. DirTree allows you to specify the directory using the -directory option which will populate the DirTree widget for you.

DirTree should simplify the population of the widget entries, and the binding as well, compared to the other approaches, though all of the mentioned approaches should work fine. You might even consider trying all three as an introduction to learning Tk.

Side note to liverpole: that was a nice intro to Text tags (++).

Rob

In reply to Re: TK question: navigating frames by rcseege
in thread TK question: navigating frames by tamaguchi

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.