GET_FILTERED_FILE@

Platform

Win32, x64

Purpose

To access the standard 'open' dialog box.

Syntax

 SUBROUTINE GET_FILTERED_FILE@(TITLE, FILE, PATH,
+  FILTERNAMES, FILTERSPECS, NFILTERS, MUSTEXIST )
 CHARACTER(*) TITLE, FILE, PATH, FILTERNAMES, FILTERSPECS
 INTEGER NFILTERS, MUSTEXIST

Description

This function can be used instead of %fs (Directory for File Dialog) and %ft (Filter for File Dialog) in cases where the filters need to be set dynamically. The arguments are as follows:

 

TITLE:

The caption for the dialog box.

 

FILE:

The full path returned by the dialog box.

 

PATH:

The input path.

 

FILTERNAMES:

An array of strings for the description of file filters.

 

FILTERSPECS:

An array of strings for the corresponding filters.

 

NFILTERS

The number of file filters.

 

MUSTEXIST:

An input value that is set to 1 if the file to be selected must already exist.

Notes

After this routine has been called, CLEARWIN_INFO@('FILTER_ITEM_SELECTED') provides the index of the file filter that was selected by the user. This can be called, for example, to detect if the file was saved using a different file extension.

Previously 64 bit ClearWin+ used an indirect call to the Windows API whilst 32 bit ClearWin+ used a direct call. Now both 64 bit and 32 bit ClearWin+ use a direct call by default whilst the indirect method is available as an option. The alternative is a little slower but might generally prove to be safer. Make a prior call:

CALL CLEARWIN_OPTION@("alt_open_save")

in order to activate the indirect alternative. The opposite is:

CALL CLEARWIN_OPTION@("-alt_open_save")

See also

GET_MULTIPLE_FILENAMES@

Example

 


     WINAPP
     INTEGER i,winio@,open_func
     EXTERNAL open_func
     i=winio@('%ca[Image info]&')
     i=winio@('%mn[&File[&Open,E&xit]]',open_func,'EXIT')
     END
c------------------------------------------------------------
     INTEGER FUNCTION open_func()
     INCLUDE <windows.ins>
     CHARACTER file*129,format*12,title*20,path*129
     INTEGER NFILTERS
     PARAMETER(NFILTERS=2) 
     CHARACTER*20 filtname(NFILTERS),filtspec(NFILTERS)
     title='Open Bitmap File'
     file=' '
     path='c:\windows'
     filtname(1)='Bitmap files'
     filtspec(1)='*.bmp'
     filtname(2)='All files'
     filtspec(2)='*.*'
     CALL get_filtered_file@(title,file,path,filtname,filtspec,
    +                         NFILTERS,1)
       . . . .
     open_func=1
     END

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited