fltk.dialog

FLTK Dialog Functions

This module provides simple dialog functions for common user interactions:

  • Message and alert dialogs
  • Question dialogs with Yes/No or custom buttons
  • Text input dialogs
  • Password input dialogs

    Authors

    Dejan Lekić

    License

    BSD-3-Clause

Types 5

Beep types for the beep() function.

defaultBeep = 0Default system beep
message = 1Message notification beep
error = 2Error notification beep
question = 3Question notification beep
password = 4Password notification beep
notification = 5General notification beep

File chooser types for NativeFileChooser.

browseFile = 0Browse for a single file
browseDirectory = 1Browse for a directory
browseMultiFile = 2Browse for multiple files
browseMultiDirectory = 3Browse for multiple directories
browseSaveFile = 4Browse for save file location
browseSaveDirectory = 5Browse for save directory location

Native file chooser dialog.

Provides platform-native file selection dialogs for opening and saving files. Uses the operating system's native file chooser for a consistent user experience.

Example:

auto chooser = new NativeFileChooser(FileChooserType.browseFile);
chooser.title = "Open File";
chooser.filter = "Text Files\t*.txt\nAll Files\t*";
if (chooser.show() == 0) {
    string filename = chooser.filename;
    // Open the file...
}

Fields
Methods
string title() constGets the dialog title.
void title(string value)Sets the dialog title.
string filter() constGets the file filter pattern.
void filter(string value)Sets the file filter pattern.
string directory() constGets the initial directory.
void directory(string value)Sets the initial directory.
string presetFile() constGets the preset filename.
void presetFile(string value)Sets the preset filename.
int show()Shows the file chooser dialog.
int count() constGets the number of selected files.
string filename() constGets the first selected filename.
string filename(int index) constGets a selected filename by index.
string[] filenames() constGets all selected filenames.
string errorMessage() constGets the error message if show() returned -1.
bool isValid() const @safe nothrow @nogcChecks if the handle is valid.
Constructors
this(FileChooserType type = FileChooserType.browseFile)Creates a new native file chooser.
Destructors

Color chooser mode.

rgb = 0RGB sliders
byteMode = 1Byte value sliders (0-255)
hex = 2Hex input
hsv = 3HSV sliders
structColor

RGB color structure for color chooser.

Fields
double r
double g
double b
Methods
Color fromBytes(ubyte red, ubyte green, ubyte blue)Creates a color from RGB byte values.
ubyte[3] toBytes() constConverts to RGB byte values.

Functions 8

fnvoid alert(string message)Shows an alert dialog with an OK button.
fnvoid message(string message)Shows a message dialog with an OK button.
fnvoid beep(BeepType type = BeepType.defaultBeep)Plays a system beep sound.
fnbool ask(string message)Shows a question dialog with Yes/No buttons.
fnint choiceDialog(string message, string b0, string b1 = null, string b2 = null)Shows a choice dialog with up to 3 buttons.
fnstring inputDialog(string message, string defaultValue = null)Shows a text input dialog.
fnstring passwordDialog(string message, string defaultValue = null)Shows a password input dialog.
fnColor * colorChooser(string title, Color initialColor = Color.init, ColorMode mode = ColorMode.rgb)Shows a color chooser dialog.