Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
File dialog and file monitor
This module offers a quite complete file dialog layout.
Popup
on top of any existing layout. It can also be inserted anywhere just like any other layout.Warning: Some options
are not implemented yet; these -- and more features -- will certainly be added in the future.
module Monitor : sig ... end
Monitoring changes in a directory.
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 ->
options
The entry
type can be used to create filters for selecting what is actually displayed by the file dialog.
val filename : entry -> string
val lstat_opt : entry -> Unix.stats option
val stat_opt : entry -> Unix.stats option
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.
val get_selected : t -> string list
Return the (alphabetically sorted) list of selected files or directories.
val basedir : t -> string
val select_file :
?dst:Layout.t ->
?board:Main.board ->
?w:int ->
?h:int ->
?mimetype:Str.regexp ->
?name:string ->
string ->
(string -> unit) ->
unit
Open a file selector on top of the dst
layout, or in a new window if dst
is not provided.
val select_files :
?dst:Layout.t ->
?board:Main.board ->
?w:int ->
?h:int ->
?mimetype:Str.regexp ->
?n_files:int ->
string ->
(string list -> unit) ->
unit
Similar 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 can be selected.
val select_dir :
?dst:Layout.t ->
?board:Main.board ->
?w:int ->
?h:int ->
?name:string ->
string ->
(string -> unit) ->
unit
Similar to select_file
except that here only a directory can be selected.
val select_dirs :
?dst:Layout.t ->
?board:Main.board ->
?w:int ->
?h:int ->
?n_dirs:int ->
string ->
(string list -> unit) ->
unit
Similar 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) ->
unit
( 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))