I have a front end gui I am working on and am trying to figure a way to create a label bar (on top of a ROText widget) that looks something like the following:

Filename Type Size Speed Location


Beneath this I will have a list of information that is being collected from a database and will be populating in it's respective place in the list, ie. the filename will appear under "Filename", the type of file will appear under "Type and so on. Now my issue is I would like to make this lable menu adjustable and have the corresponding text in the list adjust with it.

This is a common thing in gui's written in C# or C++ but I have not been able to come up with a way to mimic this in perl. If possible I would also like to be able to click each of these labels and have the list sort according to that category.

Here is what I have for code as of now:
#!/usr/bin/perl -w use Tk; use Tk::ROText; use Tk::Photo; use strict; my ($font, $bsize, $size) = ('Garamond', '12', '10'); my ($filename, $artist); my $window = MainWindow->new(); $window->title("viva la fileshare"); $window->minsize(900, 600); my $menuframe = $window->Frame()->pack(-side=>'left', -anchor=>'n', +-fill=>'y'); my $buttonframe = $menuframe->Frame()->pack(-side=>'top', -anchor=>'n' +, -fill=>'none'); my $mframe = $buttonframe->Frame()->pack(-side=>'left', -anchor=> +'n', -fill=>'none'); my $mframe2 = $buttonframe->Frame()->pack(-side=>'left', -anchor=> +'n', -fill=>'none'); my $menudisplay = $menuframe->Frame(-relief=>'sunken', -borderwidth=>5 +, -bg=>'#404040')-> pack(-pady=>5, -padx=>5, -ipady=>5, -ipa +dx=>5, -side=>'top', -anchor=>'n', -fill=>'both', -expand=>1); my $mainframe = $window->Scrolled("ROText", -scrollbars => 'e', -font +=> [$font, $size], -background => 'white')-> pack(-pady=>10, -padx=>10, -ipady=>10, -ipadx +=>10, -side=>'top', -fill=>'both', -expand=>1); my $topframe = $mainframe->Frame(-relief=>'sunken', -borderwidth=>5, - +bg=>'#404040')-> pack(-side=>'top', -anchor=>'n', -fill=>'x' +); my $statusframe = $window->Scrolled("ROText", -scrollbars => 'e', -hei +ght => '8', -font => [$font, $size], -background => 'white')-> pack(-pady=>10, -padx=>10, -ipady=>10, -ipa +dx=>10, -side=>'top', -fill=>'x', -expand=>0); my $controlframe = $window->Frame(-bg=>'#404040')-> pack(-pady =>5, -padx =>5, -ipady =>5, -ipadx =>5, +-side =>'top', -anchor=>'center', -fill =>'both'); my $subCframe = $controlframe->Frame(-bg=>'#404040')-> pack(-pady =>5, -padx =>5, -side =>'top', -anchor=> +'center', -fill =>'none'); $mframe->Label(-text=>"Select Type:", -font => [$font, $bsize])->pack( +-side=>'top', -anchor=>'w'); $mframe->Button(-text=>"Any Type", -width=>'10', -font => [$font, $bsi +ze], -command=>sub {DisplaySearch('any type')})-> pack(-side=>'top', -anchor=>'w', -fill=>'none'); $mframe->Button(-text=>"Images", -width=>'10', -font => [$font, $bsize +], -command=>sub {DisplaySearch('image')})-> pack(-side=>'top', -anchor=>'w', -fill=>'none'); $mframe->Button(-text=>"Documents", -width=>'10', -font => [$font, $bs +ize], -command=>sub {DisplaySearch('documents')})-> pack(-side=>'top', -anchor=>'w', -fill=>'none'); $mframe2->Label(-text=>"", -font => [$font, $bsize])->pack(-side=>'top +', -anchor=>'w'); $mframe2->Button(-text=>"Audio", -width=>'10', -font => [$font, $bsize +], -command=>sub {DisplaySearch('audio')})-> pack(-side=>'top', -anchor=>'w', -fill=>'none'); $mframe2->Button(-text=>"Video", -width=>'10', -font => [$font, $bsize +], -command=>sub {DisplaySearch('video')})-> pack(-side=>'top', -anchor=>'w', -fill=>'none'); $mframe2->Button(-text=>"Programs", -width=>'10', -font => [$font, $bs +ize], -command=>sub {DisplaySearch('programs')})-> pack(-side=>'top', -anchor=>'w', -fill=>'none'); DisplaySearch('any type'); $subCframe->Button(-text=>"Kill Download", -width=>'20', -font => [$fo +nt, $bsize], -command=>\&kill)-> pack(-side=>'left', -anchor=>'center', -fill=>'none'); $subCframe->Button(-text=>"Find Other Sources", -width=>'20', -font => + [$font, $bsize], -command=>\&sources)-> pack(-side=>'left', -anchor=>'center', -fill=>'none'); $subCframe->Button(-text=>"Clear Inactive", -width=>'20', -font => [$f +ont, $bsize], -command=>\&clear)-> pack(-side=>'left', -anchor=>'center', -fill=>'none'); $topframe->Label(-text=>"File\t\t\t\t\t\t\t\t\t\t\tType\t\tSize\t\t\tS +peed\t\t\tLocation", -font => [$font, $size], -bg=>'#404040', -fg=>'# +FFFFFF')-> pack(-side=>'left', -anchor=>'w', -fill=>'x'); MainLoop; sub DisplaySearch { chomp(my $type = uc(shift)); $menudisplay->destroy(); $menudisplay = $menuframe->Frame(-relief=>'sunken', -borderwidth=>5 +, -bg=>'#404040')-> pack(-pady=>5, -padx=>5, -ipady=>5, -ipa +dx=>5, -side=>'top', -anchor=>'n', -fill=>'both', -expand=>1); $menudisplay->Label(-text=>$type, -font => [$font, 15], -bg=>'#4040 +40', -fg=>'#FFFFFF')->pack(-side=>'top', -anchor=>'center'); $menudisplay->Label(-text=>"Filename:", -font => [$font, $bsize], - +bg=>'#404040', -fg=>'#FFFFFF')->pack(-side=>'top', -anchor=>'w'); $menudisplay->Entry(-textvariable=>\$filename, -font => [$font, $bs +ize], -bg=>'#FFFFFF', -fg=>'#404040')->pack(-side=>'top', -anchor=>'c +enter'); if (lc($type) eq 'audio') { $menudisplay->Label(-text=>"Artist:", -font => [$font, $bsize], +-bg=>'#404040', -fg=>'#FFFFFF')->pack(-side=>'top', -anchor=>'w'); $menudisplay->Entry(-textvariable=>\$artist, -font => [$font, $b +size], -bg=>'#FFFFFF', -fg=>'#404040')->pack(-side=>'top', -anchor=>' +center'); } $menudisplay->Button(-text=>"Search", -width=>'7', -font=>[$font, $ +bsize], -command=> sub {searchTest(lc($type), $filename)})-> pack(-pady=>5, -padx=>5, -side=>'top', -anchor=>'w'); $menudisplay->Label(-text=>"perlSkripts.com", -width=>'17', -font = +> [$font, 15], -bg=>'#404040', -fg=>'#FFFFFF')-> pack(-side=>'bottom', -anchor=>'center'); } sub kill { } sub sources { } sub clear { } sub searchTest { my ($type, $target) = @_; if (defined($type) && defined($target)) { print "Type is: $type -- Filename is: $target\n"; } else { print "Enter a search subject jackass!\n"; } }


As of now I simply have a Label widget inside the ROText widget displaying the label menu I am working on in a simple tabbed seperated format. This represent about the default seperation I am wanting. Is this possible?

In reply to perl/Tk and expandable widgets by Elijah

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.