[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Folder Selection Dialog?



At 22.49 -0500 2000.06.08, Andrew Robinson wrote:
>    I need to select a folder in an application and would love to use a
>dialog to make it slick. I did not see how in MPAE and couldn't figure
>out how to get StandardGetFile or CustomGetFile to return a folder name.
>Can I do this? Could some kind soul show me how?

#!perl
use strict;
use Mac::Files;
require 'GUSI.ph';

my $dir = GetFolder('Pick a folder ... ',
  FindFolder(kOnSystemDisk(), kDesktopFolderType())
);
print $dir,"\n";

sub GetFolder {
  my($prompt, $default) = @_;
  MacPerl::Choose(
    GUSI::AF_FILE(),                          # domain
    0,                                        # type
    $prompt,                                  # prompt
    '',                                       # constraint
    GUSI::CHOOSE_DIR() +
      ($default ? &GUSI::CHOOSE_DEFAULT : 0), #flag
    $default
   );
}

__END__

-- 
Chris Nandor       |     pudge@pobox.com      |     http://pudge.net/
Andover.Net        | chris.nandor@andover.net | http://slashcode.com/

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org