Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Open Directory using Win32:GUI?

by mr_dont (Beadle)
on Jan 10, 2002 at 01:11 UTC ( #137570=perlquestion: print w/replies, xml ) Need Help??

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

Hi fellow monks,

I have been charged with a Perl (*yay!*) on Windows (*shudder*) project, and I am making a GUI interface (using Win32:GUI) to help users configure the script for themselves. Win32:GUI is a great module, but I need to be able to select whole directories (rather than just files). I can't seem to find a Win32:GUI method that will allow me to do this!

Does any monk have experience with Win32:GUI? Any other suggestions before I work on a hack that will, say, allow me to parse directories and send the output to a listbox widget (i.e. basically create my own directory selection widget using other GUI components?)...

Thanks monks,

Mr. Don't!

Replies are listed 'Best First'.
Re: Open Directory using Win32:GUI?
by Gerard (Pilgrim) on Jan 10, 2002 at 07:51 UTC
    Righto... I found some stuff, but not exactly what I was after
    From the Documentation...
    BrowseForFolder( OPTIONS ) Displays the standard ``Browse For Folder'' dialog box. Returns the selected item's name, or undef if no item was selected or an error occurred. Note that BrowseForFolder must be called as a standalone function, not as a method. Example:
    $folder = Win32::GUI::BrowseForFolder( -root => "C:\\Program Files", -includefiles => 1, );
    other options are... -computeronly, -domainonly, -driveonly, -editbox, -folderonly, -includefiles, -owner, -printeronly, -root, -title
    What I was actually thinking of was
    $ret = GUI::GetSaveFileName( -title => "Save your newly generated Mail Merge Document.", -file => "\0" . " " x 256, -filter => [ "Word documents (*.doc)" => "*.doc", "All files", "*.*", ],
    With another option in there, but I can't find it anywhere. Oh well, I am sure that browse for folder will work. Let me know how you get on.
    Regards, Gerard.

      That's strange, last time I wanted to do this I had to use Win32::FileOp from Jan Krynicky. Maybe it was added to Win32::GUI in a recent version or I just overlooked the docs before.

      It's not bad though, Win32::FileOp has some other nice functions for deleting\recyclying files etc. Worth a look.

      update: Oh, you can use Win32::FileOp::BrowseForFolder() in a console script and avoid the overhead of loading Win32::GUI.



      Simon Flack ($code or die)
      $,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
      =~y'_"' ';eval"die";print $_,lc substr$@,0,3;

      YES, Win32::GUI::BrowseForFolder is perfect! That is the widget I am looking for...

      Thank you Gerard! It was really nice of you to help me out with this widget. I often find when I am learning a new set of GUI widgets/methods, I know that a certain call to a widget exists (because I've seen the widget!), but I have trouble finding the actual name of the method...

      I owe you one!

      Mr. Don't

Re: Open Directory using Win32:GUI?
by Gerard (Pilgrim) on Jan 10, 2002 at 02:31 UTC
    I assume that what you want is an open file dialog box that selects an entire directory instead of just a file?
    I have done this before though, but it slips my memory how exactly to do it. I do not have the documentation, nor the program handy at the moment.
    If this is what you are after then let me know and I will look it up when I get home. Don't go reinventing any wheels now though, as I have tried this sort of thing before too, with win32::gui and although it worked it proved to be much more trouble than it was worth.
    Regards, Gerard.

      Yes Gerard,

      That is exactly what I was hoping to do...

      I also feel like I've seen an example of this somewhere, but i have been searching the Internet all day and can't quite seem to pin down where it was.

      Thanks for your help!

      Mr. Don't

        I'll be able to give you the answer in ~ 2-3 hours.
Re: Open Directory using Win32:GUI?
by unobserved (Initiate) on Jan 10, 2002 at 20:46 UTC
    You should also try the Win32::GUI Mailing List. It tends to be fairly well trafficed and you can get most of your specific Win32::GUI questions answered pretty quickly.

    Don't have the address handy though (just unsubscribed after realising I hadn't read or sent a message to the list in 3-4 months) check the POD.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://137570]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2021-12-03 22:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (30 votes). Check out past polls.

    Notices?