⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getopenfile.n

📁 linux系统下的音频通信
💻 N
字号:
'\"'\" Copyright (c) 1996 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" SCCS: @(#) getOpenFile.n 1.8 96/12/08 21:14:31'\" .so man.macros.TH tk_getOpenFile n 4.2 Tk "Tk Built-In Commands".BS'\" Note:  do not modify the .SH NAME line immediately below!.SH NAMEtk_getOpenFile, tk_getSaveFile \- pop up a dialog box for the user to select a file to open or save..PP.PP.SH SYNOPSIS\fBtk_getOpenFile \fR?\fIoption value ...\fR?.br\fBtk_getSaveFile \fR?\fIoption value ...\fR?.BE.SH DESCRIPTION.PPThe procedures \fBtk_getOpenFile\fR and \fBtk_getSaveFile\fR pop up adialog box for the user to select a file to open or save. The\fBtk_getOpenFile\fR command is usually associated with the \fBOpen\fRcommand in the \fBFile\fR menu. Its purpose is for the user to select anexisting file \fIonly\fR. If the user enters an non-existent file, thedialog box gives the user an error prompt and requires the user to givean alternative selection. If an application allows the user to createnew files, it should do so by providing a separate \fBNew\fR menu command..PPThe \fBtk_getSaveFile\fR command is usually associated with the \fBSaveas\fR command in the \fBFile\fR menu. If the user enters a file thatalready exists, the dialog box prompts the user for confirmationwhether the existing file should be overwritten or not..PPThe following \fIoption\-value\fR pairs are possible as command linearguments to these two commands:.TP\fB\-defaultextension\fR \fIextension\fRSpecifies a string that will be appended to the filename if the userenters a filename without an extension. The defaut value is the emptystring, which means no extension will be appended to the filename inany case. This option is ignored on the Macintosh platform, whichdoes not require extensions to filenames..TP\fB\-filetypes\fR \fIfilePatternList\fRIf a \fBFile types\fR listbox exists in the file dialog on the particularplatform, this option gives the \fIfiletype\fRs in this listbox. Whenthe user choose a filetype in the listbox, only the files of that typeare listed. If this option is unspecified, or if it is set to theempty list, or if the \fBFile types\fR listbox is not supported by theparticular platform then all files are listed regardless of theirtypes. See the section SPECIFYING FILE PATTERNS below for adiscussion on the contents of \fIfilePatternList\fR..TP\fB\-initialdir\fR \fIdirectory\fRSpecifies that the files in \fIdirectory\fR should be displayedwhen the dialog pops up. If this parameter is not specified, thenthe files in the current working directory are displayed. If theparameter specifies a relative path, the return value will convert therelative path to an absolute path.  This option may not always work onthe Macintosh.  This is not a bug. Rather, the \fIGeneral Controls\fRcontrol panel on the Mac allows the end user to override theapplication default directory..TP\fB\-initialfile\fR \fIfilename\fRSpecifies a filename to be displayed in the dialog when it popsup. This option is ignored by the \fBtk_getOpenFile\fR command..TP\fB\-parent\fR \fIwindow\fRMakes \fIwindow\fR the logical parent of the file dialog. The filedialog is displayed on top of its parent window..TP\fB\-title\fR \fItitleString\fRSpecifies a string to display as the title of the dialog box. If thisoption is not specified, then a default title is displayed. Thisoption is ignored on the Macintosh platform..PPIf the user selects a file, both \fBtk_getOpenFile\fR and\fBtk_getSaveFile\fR return the full pathname of this file. If theuser cancels the operation, both commands return the empty string..SH "SPECIFYING FILE PATTERNS"The \fIfilePatternList\fR value given by the \fB\-filetypes\fR optionis a list of file patterns. Each file pattern is a list of theform.CS\fItypeName\fR {\fIextension\fR ?\fIextension ...\fR?} ?{\fImacType\fR ?\fImacType ...\fR?}?.CE\fItypeName\fR is the name of the file type described by thisfile pattern and is the text string that appears in the \fBFile types\fRlistbox. \fIextension\fR is a file extension for this file pattern.\fImacType\fR is a four-character Macintosh file type. The list of\fImacType\fRs is optional and may be omitted for applications that donot need to execute on the Macintosh platform..PPSeveral file patterns may have the same \fItypeName,\fR in which casethey refer to the same file type and share the same entry in thelistbox. When the user selects an entry in the listbox, all the filesthat match at least one of the file patterns correspondingto that entry are listed. Usually, each file pattern corresponds to adistinct type of file. The use of more than one file patterns for onetype of file is necessary on the Macintosh platform only..PPOn the Macintosh platform, a file matches a file pattern if itsname matches at least one of the \fIextension\fR(s) AND itbelongs to at least one of the \fImacType\fR(s) of thefile pattern. For example, the \fBC Source Files\fR file pattern in thesample code matches with files that have a \fB\.c\fR extension ANDbelong to the \fImacType\fR \fBTEXT\fR. To use the OR rule instead,you can use two file patterns, one with the \fIextensions\fR only andthe other with the \fImacType\fR only. The \fBGIF Files\fR file typein the sample code matches files that EITHER have a \fB\.gif\fRextension OR belong to the \fImacType\fR \fBGIFF\fR..PPOn the Unix and Windows platforms, a file matches a file patternif its name matches at at least one of the \fIextension\fR(s) ofthe file pattern. The \fImacType\fRs are ignored..SH "SPECIFYING EXTENSIONS".PPOn the Unix and Macintosh platforms, extensions are matched usingglob-style pattern matching. On the Windows platforms, extensions arematched by the underlying operating system. The types of possibleextensions are: (1) the special extension * matches anyfile; (2) the special extension "" matches any files thatdo not have an extension (i.e., the filename contains no full stopcharacter); (3) any character string that does not contain any wildcard characters (* and ?)..PPDue to the different pattern matching rules on the various platforms,to ensure portability, wild card characters are not allowed in theextensions, except as in the special extension *. Extensionswithout a full stop character (e.g, ~) are allowed but may notwork on all platforms..SH EXAMPLE.CSset types {    {{Text Files}       {.txt}        }    {{TCL Scripts}      {.tcl}        }    {{C Source Files}   {.c}      TEXT}    {{GIF Files}        {.gif}        }    {{GIF Files}        {}        GIFF}    {{All Files}        *             }}set filename [tk_getOpenFile -filetypes $types]if {$filename != ""} {    # Open the file ...}.CE.SH KEYWORDSfile selection dialog

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -