in reply to The right Tk file selecter

I should confess that I hate file-selection widgets, especially the ones that assume the user can't possibly know what he wants or where anything is until you show it to him in excruciating detail, and therefore he has to be walked through every single layer up and down the directory structure in baby-steps -- bleah! It makes me sore.

So that would explain why I would actually recommend you go ahead and roll your own in this case. I know, from prior SoPW threads where we've both posted relevant help, that you can handle "File::Find" or choose a command-line "find" + "readdir" approach without any trouble. All you need beyond that is a good idea of how the tool should behave, one or two scrollable Listboxes, a Label or two, a nice wide Entry widget where you can type or paste, and maybe a dynamic "combo-box" style pull-down (a fancy way to keep a history of paths and/or files already visited). There's not that much to doing a decent job of it. And you'll know for sure that you can make it fit nicely with the rest of your GUI layout.

I realize I'm overstating the simplicity a little bit, but most of the subtlety is just a matter of keeping track of where you are, and knowing enough about what the user needs so that you keep it both simple and effective. I'd spend a little extra time looking for a way to have an Entry widget where I can type in a path and have filename completion bound to the tab key. (I don't know if any of the file-selector dialogs provide this. It's crippling not to have it.)

If you want to go in for all the cute decorations (icons determined by file-type, yadda yadda), then just ignore me, and good luck with the pre-packaged widget that gives you all that.

Replies are listed 'Best First'.
Re: Re: The right Tk file selecter
by etcshadow (Priest) on Mar 30, 2004 at 03:53 UTC
    Well, I'm not trying to find something terribly fancy, I was just trying to save a little bit of work. Really all that I'm doing is trying to put a GUI interface on a simple perl script that's basically used like:
    x12concatenate outfile.x12 infile1.x12 [infile2.x12 ...]
    Very, very simple... just picking a list of input files and an output file. It's just something I have to hand off to someone else in the company who really isn't quite savee enough to handle command lines and shell globs. :-)

    The funny thing is that it wouldn't take a heck of a lot more work to turn it into a general "run a script" wrapper which could parse a standard command line "usage" description and give a UI for launching the script... well, maybe that would still be a bit of work... but you get the idea. MakeOpt::GUI, or something... heh. Maybe I'll work on that for CPAN after "the Company" clears me to put r.pm up on CPAN.

    ------------ :Wq Not an editor command: Wq