Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter NineDialog Functions (continued)

BrowseOpenFile Function

Overview

The BrowseOpenFile function allows the selection of a single file presumably for an open or other operation.

Syntax/Parameters

Syntax

string = BrowseOpenFile ( string title, [string filter], [string path] );

Parameters

title

A string that becomes the dialog’s caption. Note that for browse dialogs, the dialog caption is used to store sticky path information in application’s settings file. Depending on the application settings, the path may be remembered and used assuming no incoming path is provided to the function.

filter

A string that specifies an optional filter list. If a filter list is not provided, the default of “All Files (*.*)” will be added to the filter list. See Filters at the start of Section 9.2 Common Dialogs for filter string formatting information.

path

Specifies an optional string to direct the opening path. If a path is not provided, the last path selected for the specified title is used. Barring that, the application’s current working directory is used.

Return Value

Returns a string as either a path, a string or an empty string on error. Use GetLastError to determine the error. The most common error is ERROR_CANCEL for the user pressing the “Cancel” button.

The return string will be a qualified and valid filename and path.

The result is UTF encoded to allow the representation of Unicode data. Use the UTFToUnicode function and related functions to convert to Unicode.

Remarks

The return of filename does not indicate that the script process and user have permission to access the file.

The function will use the Windows Common Open file dialog based on Windows Explorer or the application’s browse class depending on the application settings.

Examples

    string              s1, filters;
    int                 rc;
    
    s1 = BrowseOpenFile("Test #1, No Filters");
    rc = GetLastError();
    MessageBox('I', "Test #1 Returns:\r\r%s\r\rError: %08X", s1, rc);
    
    filters = "All Files *.*|*.*&Comma Delimited Data *.csv|*.csv&HTML Files *.htm|*.htm;*.html";
    s1 = BrowseOpenFile("Test #2, With Filters", filters);
    rc = GetLastError();
    MessageBox('I', "Test #2 Returns:\r\r%s\r\rError: %08X", s1, rc);
    
    filters = "All Files *.*|*.*&DLLs and System *.dll, *.sys|*.dll;*.sys&Executable *.exe|*.exe";
    s1 = BrowseOpenFile("Test #3, With Path", filters, "C:\\Windows\\");
    rc = GetLastError();
    MessageBox('I', "Test #3 Returns:\r\r%s\r\rError: %08X", s1, rc);

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic

Page revised 2024-12-13