Module Tinyfiledialogs

OCaml bindings for TinyFileDialogs

Dialog Types

type dialog_type =
  1. | Ok
  2. | OkCancel
  3. | YesNo
  4. | YesNoCancel
    (*

    Type of dialog for message boxes.

    *)
type default_button =
  1. | CancelNo
  2. | OkYes
  3. | No
    (*

    The default selected button in a message box.

    *)
type icon_type =
  1. | Info
  2. | Warning
  3. | Error
  4. | Question
    (*

    Icon type for message boxes and notifications.

    *)

Dialog Functions

val input_box : title:string -> message:string -> default_input:string -> string option

Display an input box dialog. Returns Some input if the user provides input, None if cancelled.

val message_box : title:string -> message:string -> dialog_type:dialog_type -> icon_type:icon_type -> default_button:default_button -> int

Display a message box. Returns 0, 1, or 2 depending on the button pressed:

  • 0: Cancel / No
  • 1: Ok / Yes
  • 2: No (only for YesNoCancel)
val save_file_dialog : title:string -> default_path:string -> filter_patterns:string list option -> filter_desc:string -> string option

Show a save file dialog. Returns Some filename if a file was selected, None if cancelled.

val open_file_dialog : title:string -> default_path:string -> filter_patterns:string list option -> filter_desc:string -> allow_multiple:bool -> string option

Show an open file dialog. If allow_multiple is true, multiple filenames are returned separated by '|' in the string.

val select_folder_dialog : title:string -> default_path:string -> string option

Show a folder selection dialog. Returns Some folder_path if a folder is selected, None if cancelled.

val color_chooser : title:string -> default_hex:string option -> default_rgb:(int * int * int) -> (string * int * int * int) option

Show a color chooser dialog. Returns Some (hex, r, g, b) if a color is chosen, None if cancelled. default_hex can override default_rgb.

Notifications and Sound

val beep : unit -> unit

Play a system beep sound.

val notify_popup : title:string -> message:string -> icon_type:icon_type -> unit

Display a system notification popup with the given title, message, and icon_type.