Blitz3D+ Command Reference

RequestFile$ ( [prompt$][,exts$][,save][,defname$] )

Parameters

prompt$ (optional) - title text for the dialog; "" uses the standard title (default)

exts$ (optional) - comma-separated file extensions to offer as filters, e.g. "bb,txt"; "" offers all files (default)

save (optional) - 0 shows an Open dialog (default); any other value shows a Save dialog

defname$ (optional) - suggested file name and/or starting folder; "" (default)

Description

Opens a file requester and returns the chosen file path, or an empty string on cancel.

Requires Extended language mode.

The everyday Open/Save dialog for tools. Each entry in exts$ becomes a filter in the file-type drop-down: "bb,txt" offers "bb files (*.bb)" and "txt files (*.txt)". A "*" entry (or an empty exts$) offers all files. To group several patterns under one filter, separate them with semicolons inside the entry - "png;jpg" matches both.

With save=0 the dialog only accepts files that exist. With save non-zero it becomes a Save dialog: it asks before overwriting, and the first filter's extension is added automatically when the user types a bare name. defname$ can carry a file name ("untitled.bb"), a folder to start in, or both ("C:\Levels\untitled.bb").

level$=RequestFile("Open a level","bb")
If level$<>"" Then LoadLevel level$

The returned path is full UTF-8 path text. The dialog is modal, owned by your active GUI window, and posts begin/end-modal events ($2004/$2005) to the shared event queue. If defname$ is not valid path text for this system the call stops with a runtime error describing the problem.

See also: RequestDir, Proceed, Confirm, Notify.

Index