Scroll to navigation

SDL_DialogFileCallback(3type) SDL3 DATATYPES SDL_DialogFileCallback(3type)

NAME

SDL_DialogFileCallback - Callback used by file dialog functions.

SYNOPSIS

#include <SDL3/SDL_dialog.h>
typedef void (SDLCALL *SDL_DialogFileCallback)(void *userdata, const char * const *filelist, int filter);

DESCRIPTION

The specific usage is described in each function.

If filelist is:

• NULL, an error occurred. Details can be obtained with SDL_GetError().

• A pointer to NULL, the user either didn't choose any file or canceled the dialog.

• A pointer to non-NULL, the user chose one or more files. The argument is a null-terminated array of pointers to UTF-8 encoded strings, each containing a path.

The filelist argument should not be freed; it will automatically be freed when the callback returns.

The filter argument is the index of the filter that was selected, or -1 if no filter was selected or if the platform or method doesn't support fetching the selected filter.

In Android, the filelist are content:// URIs. They should be opened using SDL_IOFromFile() with appropriate modes. This applies both to open and save file dialog.

FUNCTION PARAMETERS

an app-provided pointer, for the callback's use.
the file(s) chosen by the user.
index of the selected filter.

AVAILABILITY

This datatype is available since SDL 3.2.0.

SEE ALSO

SDL_DialogFileFilter(3type), SDL_ShowOpenFileDialog(3), SDL_ShowSaveFileDialog(3), SDL_ShowOpenFolderDialog(3), SDL_ShowFileDialogWithProperties(3)

SDL 3.2.14 Simple Directmedia Layer