FileDialog

class FileDialog(val native: Boolean = GlokSettings.nativeFileDialogs)

File Open, File Save and Folder Picker dialogs.

Note. There is an option to use native controls, or Glok controls. (See native boolean parameter of the constructor).

Initially, only native controls were possible, but I added Glok controls, and made this the default because :

  1. The native library seems to have a critical bug when running on Linux. It very occasionally crashes the application :-( (This library is part of LWJGL - which provide all the OpenGL wrappers and other goodies).

  2. The native dialogs really annoy me - they ignore the initialDirectory I've read somewhere that this is deliberate, because users were confused by this feature. WTF? So now I have to navigate to the same folder again and again just to Save-As with a new name? No, that's madness!

  3. The native library's API is dreadful, and hints that it was written by a very naive programmer.

The downsides of the Glok controls :

  1. Looks and behaves differently from the native controls

  2. Doesn't include favourite places.

  3. Doesn't include file previews

  4. There may be other features in the native controls too.

But has Glok's version have some advantages too :

  1. Uses the same Theme as your application.

  2. Allows you to browse a folder using the file-manager (via a right-click menu).

  3. They match the theme of your application.

The default value of native (in the primary constructor) is taken from GlokSettings.nativeFileDialogs. Therefore, you can easily switch between native and glok from a single place.

Constructors

Link copied to clipboard
constructor()
constructor(native: Boolean = GlokSettings.nativeFileDialogs)

Properties

Link copied to clipboard

Pairs of file type descriptions and file extensions. Each pair comprises a description (String) and a spec (String) with comma separated file extensions.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun showFolderPicker(parentStage: Stage, callback: (File?) -> Unit)
Link copied to clipboard
fun showOpenDialog(parentStage: Stage, callback: (File?) -> Unit)
Link copied to clipboard
fun showSaveDialog(parentStage: Stage, callback: (File?) -> Unit)