Procedure GetFile displays a standard file dialog which requests the user to select a text document.
It is advisable to call DidCancel after using this procedure and check that the user did not cancel the file selection process.
PROCEDURE GetFile(VAR fileName : STRING);def vs.GetFile():
return fileName| Name | Type | Description |
|---|---|---|
| fileName | STRING | Returns name of selected file. |
At least on the Mac, fileName does not set the default folder to browse. Use GetFileN if you want this functionality.
PROCEDURE Example;
VAR
fileName : STRING;
a,b,c : INTEGER;
BEGIN
GetFile(fileName);
IF NOT DidCancel THEN BEGIN
Read(a, b, c);
Close(fileName);
END;
END;
RUN(Example);def Example():
fileName = vs.GetFile()
if not vs.DidCancel():
vs.Read(a,b,c)
vs.Close(fileName)
Example()BEGIN
GetFile(MapingFile);
IF NOT DidCancel THEN
BEGIN
Open(MapingFile);
Readln(FileHeaderStr);
EnableItem(dialogID, 13, TRUE);
END;
END; {Save Settings}
14: BEGIN {Load Settings}
GetFile(LoadFile);
IF NOT DidCancel THEN
BEGIN
Open(LoadFile);
ReadLn(ValidLoadFile);
1: BEGIN
GetBooleanItem(dialogID, 22, gImportFirstRow);
END;
5: BEGIN {Browse...}
GetFile(InFile);import vs
# Procedure GetFile displays a standard file dialog which requests the user
# to select a text document.
result = vs.GetFile()Availability: from All Versions