wb_sys_dlg_open

string wb_sys_dlg_open (int parent [, string title [, string filter[, string path[, string filename]]]])

Displays the standard Open dialog box. Returns the selected file name, if any, or a blank string if the dialog box was canceled. Returns NULL if not successful.

Parameters

parent is a handle to the WinBinder object that will serve as the parent for the dialog box.
title is the string to be displayed as the dialog box caption.
filter is an two-dimensional array composed of pairs of file descriptions and valid file name patterns (usually file extensions). If filter is NULL, the dialog box will display a default "All files" filter. The filter takes the following generic form:

path is an folder used to initialize the dialog box.
filename is optional. If parameter filter is NULL, the file extension will be used as the filter instead.

Example

// How to create a file pattern filter and open a system dialog box

function process_main($window, $id)
{
    static $file_filter = array(
        array("PHP source code",    "*.php?"),
        array("Web page",           "*.htm?"),
        array("Text document",      "*.txt"),
        array("All files",          "*.*")
    );

    switch($id) { 
        case ID_OPEN:
            $filename = wb_sys_dlg_open($window, 'Get file', $file_filter, dirname(__FILE__));
            if($filename) {
                // Do action here
            }
            break;

        case IDCLOSE:
            wb_destroy_window($window);
            break;
    }
}

See also

wb_sys_dlg_save
Dialog functions