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

Dear Monks,

I need advise from a Tk user on what would be the easiest way to display two colums of data. The first one contains pre-defined data (like labels) and the other contains data from a file-- the pre-defined text describes the data from the file. There are 5 different "labels" per item. Each item needs to be able to be selected (maybe with a checkbutton). Since there might be lots of data, there is need for at least the vertical scrollbar.

I have tried with Scrolled ('Text'). The display of the labels, the checkboxes and the info from the file works fine, but I have no control over the size of the widget and the scrollbars don't work.

I have tried with an array of listboxes (two --one for the pre-defined text and one for the data from the file). This lets me control the size of the widget and the scrollbar works, but I have not figured out how to process my data and have it display in one listbox while the pre-defined text appears in the other listbox.

Any idea of what kind of widget I need?

Thank you in advance for your time,

Claire

  • Comment on array of listboxes with vertical scrollbar capable of displaying different data

Replies are listed 'Best First'.
Re: array of listboxes with vertical scrollbar capable of displaying different data
by InfiniteLoop (Hermit) on Apr 05, 2005 at 06:21 UTC
    Looks like a job for Tk::HList. Check this article on using the list box and HList: http://www.perltk.org/articles/hlist/hlist.html

      Hi Zentara and InfiniteLoop,

      Thank you so much, it works BEAUTIFULLY!

      Claire

Re: array of listboxes with vertical scrollbar capable of displaying different data
by zentara (Cardinal) on Apr 05, 2005 at 13:18 UTC
    Just to help you with your design, a little bit. What you probably want to do, is make a frame on the left, with a X-Y scrollable HList, which when selected, displays the file on the right-side frame. Here is a screenshot . It may be a little more than you need, but the script contains alot of little bits of code which you may find useful, like colors for the HList, X-Y scrolling of the HList, and paging of the HList. Here is the script and a fully working graphical demo .

    I'm not really a human, but I play one on earth. flash japh