0%

File picker

A file picker is a widget for selecting files (core.FilePicker). It supports sorting, navigation, searching, favorites, and history.

For a nested filesystem tree, use a file tree instead.

Properties

You can make a file picker:

core.NewFilePicker(b)

You can set the starting file of a file picker:

core.NewFilePicker(b).SetFilename(core.TheApp.DataDir())

Events

You can detect when a user selects a file:

fp := core.NewFilePicker(b)
fp.OnSelect(func(e events.Event) {
    core.MessageSnackbar(fp, fp.SelectedFile())
})

File button

You can make a button that opens a file picker dialog:

core.NewFileButton(b)

You can detect when a user selects a file using the dialog:

fb := core.NewFileButton(b)
fb.OnChange(func(e events.Event) {
    core.MessageSnackbar(fb, fb.Filename)
})