How do you get it to return the filename with the extension.  In sfn.pl it
added the filters *.txt and *.pl.  Is there a way to get that filter so
that if I type the name of the file and select the .txt filter I'll have
"filename.txt"?  It would be nice to think that users will type the
extension, but they don't.

Thanks,

Joe





"Frazier, Joe Jr" <[EMAIL PROTECTED]>@lists.sourceforge.net on
10/19/2001 02:25:13 PM

Sent by:  [EMAIL PROTECTED]


To:   <perl-win32-gui-users@lists.sourceforge.net>
cc:    (bcc: Joseph Vieira/DMR/CA)
Subject:  RE: [perl-win32-gui-users] Save file window

>From GUI.xs, here is the definition:

# (@)METHOD:GetSaveFileName(%OPTIONS)
    # Allowed %OPTIONS are:
    #  -owner => WINDOW
    #      [TBD]
    #  -title => STRING
    #      the title for the dialog
    #  -directory => STRING
    #      specifies the initial directory
    #  -file => STRING
    #      specifies a name that will appear on the dialog's edit field
    #  -filter => ARRAY REFERENCE
    #      [TBD]

Here is an example from sfn.pl ( included example in the source
distribution)

Add "-directory => something" to the sub arg to start in a particular
folder
I have never used the -owner flag, so I have no idea what it does.

<CODE>
use Win32::GUI;

$file = "\0" . " " x 256;

$ret = GUI::GetSaveFileName(
    -title  => "Win32::GUI::GetSaveFileName test",
    -file   => "\0" . " " x 256,
    -filter => [
        "Text documents (*.txt)" => "*.txt",
        "Perl stuff (*.pl, *.pm)" => "*.pl;*.pm",
        "All files", "*.*",
    ],
);

if($ret) {
    print "GetSaveFileName returned: '$ret'\n";
} else {
    if(GUI::CommDlgExtendedError()) {
        print "ERROR. CommDlgExtendedError is: ",
GUI::CommDlgExtendedError(), "\n";
    } else {
        print "You cancelled.\n";
    }
}

</CODE>

Basically, if $ret is defined, it is the full path to the file you want
to save. You can then perfom open, pipe, pass to constructors which take
a filename, etc.  Also, for the Openfile, you may want to play with the
Win32::GUI::BrowseForFolder function AND look back on the list several
weeks for Win32::FileOp reference.  It includes a better Openfilename
function in that you can specify a flag to open multiple file names
amoung other options not available(currently) in the
Win32::GUI::GetOpenFileName function.



> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Friday, October 19, 2001 1:53 PM
> To: perl-win32-gui-users@lists.sourceforge.net
> Subject: [perl-win32-gui-users] Save file window
>
>
>
> Hello,
>
> I was looking at the sample perl scripts and came accross
> ofn.pl, it uses
> Win32::GUI::GetOpenFileName.  Which opens up an open file
> window.  Created
> and ready to use with all the buttons.  Cool.  I couldn't find it
> documented any where and now I am wondering if there is a
> save file window
> (I really hope so).  I'd rather not have to create one if
> it's already been
> done.  Does anyone know?
>
> Thanks,
>
> Joe
>
>
>
>
> _______________________________________________
> Perl-Win32-GUI-Users mailing list
> Perl-Win32-GUI-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
>

_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users






Reply via email to