package bogue
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=991bc2e85df38feb23bddf84addd758d
sha512=8b777f7b479946528626c4112bf45600bee9aed0d94742e3eed0659f9a0517e41d0eaf398299920fd5b9f86065bd0e24035662d2df36f24f6a044c78e61dee01
doc/bogue/Bogue/File/index.html
Module Bogue.FileSource
File dialog and file monitor
This module offers a quite complete file dialog layout.
- The dialog opens either in a new window, or as a
Popupon top of any existing layout. It can also be inserted anywhere just like any other layout. - One can choose to select only files or directories.
- One can optionally limit the number of selected files.
- The file system is monitored so that changes in the currently opened directory are automatically taken into account.
- One can easily open huge directories with thousands of files.
- The file system can be easily navigated by either clicking on the children directories, or entering manually the requested path, or clicking on parents directories in a special breadcrumb layout.
- The whole layout is resizable by the user.
- The dialog can be closed by pressing ESCAPE (even if ESCAPE is used for another action in the main application).
Warning: Some options are not implemented yet; these -- and more features -- will certainly be added in the future.

File dialog in a separate window
Dependency graph
The type for file dialogs.
val set_options :
?width:int ->
?height:int ->
?dirs_first:bool ->
?show_hidden:bool ->
?hide_backup:bool ->
?max_selected:int ->
?hide_dirs:bool ->
?only_dirs:bool ->
?select_dir:bool ->
?allow_new:bool ->
?default_name:string ->
?breadcrumb:bool ->
?system_icons:bool ->
?open_dirs_on_click:bool ->
?mimetype:Str.regexp ->
?on_select:((int * int) -> unit) ->
unit ->
optionsThe entry type can be used to create filters for selecting what is actually displayed by the file dialog.
The stat_opt and lstat_opt return the corresponding pre-computed Unix.stats results, without actually calling any system function.
Use this function if you need unusual combinations of options. For most common uses, see select_file (and others) below.
Return the layout containing the whole file dialog except for the "select" and "cancel" buttons.
Return the (alphabetically sorted) list of selected files or directories.
val select_file :
?dst:Layout.t ->
?board:Main.board ->
?w:int ->
?h:int ->
?mimetype:Str.regexp ->
?name:string ->
string ->
(string -> unit) ->
unitselect_file dirname continue will open a file dialog, initially showing the content of the directory dirname. The user can then navigate to other directories. When the user selects a file in the list and presses the "Select file" button, the dialog will close, and the continue function will be applied to the selected filename (full path).
If the dialog is closed by the user pressing the "Cancel" button or the ESCAPE key, the continue function is not used.
Note that global bindings to the ESCAPE key are temporarily disabled when the file dialog is open.
val select_files :
?dst:Layout.t ->
?board:Main.board ->
?w:int ->
?h:int ->
?mimetype:Str.regexp ->
?n_files:int ->
string ->
(string list -> unit) ->
unitSimilar to select_file except that here several files can be selected. If n_files is provided, it will be the maximum number of files that may be selected.
val select_dir :
?dst:Layout.t ->
?board:Main.board ->
?w:int ->
?h:int ->
?name:string ->
string ->
(string -> unit) ->
unitSimilar to select_file except that here only a directory can be selected. If the user clicks on a directory name, they will be given the option to either open this directory (for further navigation), or select it (hence closing the dialog).
val select_dirs :
?dst:Layout.t ->
?board:Main.board ->
?w:int ->
?h:int ->
?n_dirs:int ->
string ->
(string list -> unit) ->
unitSimilar to select_files except that here only directories can be selected.
val save_as :
?dst:Layout.t ->
?board:Main.board ->
?w:int ->
?h:int ->
?name:string ->
string ->
(string -> unit) ->
unitSimilar to select_file, but here the user can enter a filename that does not already exist in the displayed directory.
( let@ ) f x is just f x . You can use this "syntaxic sugar" to write your code like this:
let open File in
let@ file = select_file "/tmp" in
print_endline ("Selected file : " ^ file)instead of
File.select_file "/tmp" (fun file ->
print_endline ("Selected file : " ^ file))