VFP getfiles()

see_eye 2011-06-15 11:04:11
各位达人,在此请教getfiles()函数的参数,返回值,用法等信息。
VFP用户手册里面看了,没有找到。
...全文
361 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
十豆三 2011-06-15
  • 打赏
  • 举报
回复 1
Visual FoxPro 9.0 语言参考
GETFILE( ) 函数
显示“打开”对话框。
GETFILE([cFileExtensions] [, cText] [, cOpenButtonCaption] [, nButtonType] [, cTitleBarCaption])

参数
cFileExtensions
指定没有选择“所有文件”菜单项时,可滚动列表中显示的文件扩展名。如果传递一个文本值, 将它括在引号("")中。文件扩展名前不要带点号(.) 注意:
cFileExtensions 参数在长度上不能超过 254 字符。
 
cFileExtensions 可具有多种形式:
如果 cFileExtensions 包含单一扩展名,例如 "prg",只显示具有此扩展名的文件。
如果 cFileExtensions 是空串, 则打开对话框显示当前目录中的所有文件。
cFileExtensions 也可以包含通配符 * 和 ?。所有文件扩展名符合通配符条件的都显示。例如, 如果 cFileExtensions 是 "X", 则打开对话框显示所有文件扩展名为 .fxp, .exe, 和 .txt 。
cFileExtensions 可以包含一个文件说明,后面带有一个或一列用逗号分隔的扩展名。这个文件说明出现在“文件类型”列表框中。使用一个冒号 (:) 将文件说明和扩展名分开。使用分号 (;) 将多个文件说明和它们的扩展名分开。 例如,如果 cFileExtensions 是 "Text:TXT",则文件说明 "Text" 出现在“文件类型”列表框中,而且显示所有具有 .txt 扩展名的文件。 如果 cFileExtensions 是 "Tables:DBF; Files:TXT,BAK",则文件说明"Tables" 和 "Files" 出现在“文件类型”列表框中。当从“文件类型”列表框中选择 "Tables" 时,则显示所有具有 .dbf 扩展名的文件。当从“文件类型”列表框中选择 "Files" 时,则显示所有具有 .txt 和 .bak 扩展名的文件。
如果 cFileExtensions 只包含分号 (";"),则显示所有不带扩展名的文件。
cText
指定“打开”对话框中目录列表的文本。
cOpenButtonCaption
为“确定(OK)”按钮指定标题。
nButtonType
指定出现在“打开”对话框中按钮的数目与类型。下表列出 nButtonType 值。 nButtonType Buttons displayed
0 ((或省略) 确定(OK),取消(Cancel)

1 确定(OK), 新建(New),取消(Cancel)

2 确定(OK), 无(None), 取消(Cancel)

注意:
如果 nButtonType 等于 1,而用户选择了“新建(New)”按钮,此函数返回在“打开”对话框中指定的路径与“尚未命名(Untitled)”。如果 nButtonType 等于 2 而用户选定了“无”按钮,函数返回空字符串。

cTitleBarCaption
指定对话框标题栏标题。
返回值
字符型。如果按 ESC 键、选择“取消(Cancel )”按钮,或者从控件菜单上选择“关闭”退出“打开”对话框,GETFILE() 函数将返回空字符串。

示例
CLOSE DATABASES
SELECT 0

gcTable=GETFILE('DBF', 'Browse or Create a .DBF:',
'Browse', 1, 'Browse or Create')
DO CASE
CASE 'Untitled' $ gcTable
CREATE (gcTable)
CASE EMPTY(gcTable)
RETURN
OTHERWISE
USE (gcTable)
BROWSE
ENDCASE
WWWWA 2011-06-15
  • 打赏
  • 举报
回复
Displays the Open dialog box.


GETFILE([cFileExtensions] [, cText] [, cOpenButtonCaption]
[, nButtonType] [, cTitleBarCaption])



Parameters
cFileExtensions


Specifies the file name extensions for the files to display in the Open dialog box when the All Files type is not chosen. When passing a value as a literal, enclose it with quotation marks (""). Do not include a period (.) in front of file name extensions.
Note:
The cFileExtensions parameter cannot exceed 254 characters in length.



cFileExtensions can take a variety of forms:
If cFileExtensions contains a single extension, for example, "prg", the Open dialog box displays only those file names with that extension.


If cFileExtensions is the empty string, the Open dialog box displays all files in the current directory.


cFileExtensions can contain wildcard characters such as * and ?. The Open dialog box displays all file names with extensions that meet the wildcard criteria. For example, if cFileExtensions is "?X?", the Open dialog box displays all file names with the extension .fxp, .exe, and .txt.


cFileExtensions can contain a file description followed by a file extension or a list of file extensions separated with commas. The file description appears in the Open dialog box in the Files of Type list. Separate the file description from the file extension or list of file extensions with a colon (:). Separate multiple file descriptions and their file extensions with a semicolon (;).

For example, if cFileExtensions is "Text:TXT", the Open dialog box displays the file description "Text" in the Files of Type list and displays all files with a .txt extension.

If cFileExtensions is "Tables:DBF; Files:TXT,BAK" the file descriptions "Tables" and "Files" appear in the Files of Type list. When "Tables" is chosen from the Files of Type list, all files with a .dbf extension are displayed. When "Files" is chosen from the Files of Type list, all files with .txt and .bak extensions are displayed.


If cFileExtensions contains just a semicolon (";"), the Open dialog box displays all files without extensions.


cText


Specifies text to display for the File Name label in the Open dialog box.
cOpenButtonCaption


Specifies a caption for the OK button in the Open dialog box.
nButtonType


Specifies the number and type of buttons that appear in the Open dialog box. The following table lists the values for nButtonType.
nButtonType Buttons displayed
0 (or omitted)
OK, Cancel

1
OK, New, Cancel

2
OK, None, Cancel


Note:
GETFILE( ) returns the string "Untitled" with the path specified in the Open dialog box when nButtonType is set to 1 and the user clicks New, or when nButtonType is set to 2 and the user clicks None.



cTitleBarCaption


Specifies the caption for the title bar of the Open dialog box.
Return Value
Character. GETFILE( ) returns the name of the file chosen in the Open dialog box or the empty string if the user closes the Open dialog box by pressing ESC, clicking Cancel or the
WWWWA 2011-06-15
  • 打赏
  • 举报
回复
CLOSE DATABASES
SELECT 0
vfp help:
gcTable=GETFILE('DBF', 'Browse or Create a .DBF:',
'Browse', 1, 'Browse or Create')
DO CASE
CASE 'Untitled' $ gcTable
CREATE (gcTable)
CASE EMPTY(gcTable)
RETURN
OTHERWISE
USE (gcTable)
BROWSE
ENDCASE
see_eye 2011-06-15
  • 打赏
  • 举报
回复
多谢各位。
不过今天又详细地问了下同事,发现那个所谓的getfiles()是一自定义函数。。。

2,723

社区成员

发帖
与我相关
我的任务
社区描述
VFP,是Microsoft公司推出的数据库开发软件,用它来开发数据库,既简单又方便。
社区管理员
  • VFP社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧