Oh Joy! - I just remembered I emailed myself the code a while ago and it's stored on an IMAP server - quick login and here it is:

This defines the mainwindow:
$top = MainWindow->new(); $top->title("Window Title"); $main_frame = $top->Frame()->pack( -fill=>'both', -expand=>1 );
Here's the OpenBox Code:
sub openfile { #print "You clicked Open..\n"; my $opentypes = [ ['CSV Files', '.csv', ], ['TXT Files', '.txt', ], ['All Files', '*', ], ]; $csvfile = $top->getOpenFile(-filetypes=>$opentypes, -title=> "Select + a CSV File"); if ($csvfile ne "") { $csv_entry_box->delete(0,99999); $csv_entry_box->insert(0,$csvfile); ui $main_frame; } }

Here's the SaveFile Sub

sub savefile { #print "You clicked Save As..\n"; my $savetypes = [ ['All Files', '*', ], ]; $outfile = $top->getSaveFile(-filetypes=>$savetypes, -title=> "Type a +n output filename"); if ($outfile ne "") { $save_entry_box->delete(0,99999); $save_entry_box->insert(0,$outfile); ui $main_frame; } }

ui is the sub which has all the unpacked widgets. so ui $main_frame packs all the widgets in ui into $mainframe Then you just need the Tk::MainLoop; call.

Sorry if this is not very clear, I can email you the full listing if you need it. I found that SpecTcl is a nice little tool to help build the GUI. I am sure I can dig out the URL for it.

Good Luck

In reply to Re: Tk and Common Dialogs by $code or die
in thread Tk and Common Dialogs by Anonymous Monk

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.