module ComboTextTree:Module for building a set (structured in a tree hierarchy) of dependent combo texts. Any change of the selected value of a particular node, cause the rebuilding of the choice list of all its descendents in the tree.sig
..end
class comboTextTree :generator:((string, string) Environment.env -> string list) -> msg:(string, string) Environment.env -> key:string -> callback:(string -> unit) option -> packing:(GObj.widget -> unit) option ->
object
..end
typechoice =
string
typechoices =
choice list
choices
represent a choice list
, of course.val make : generator:((string, choice) Environment.env ->
choice list) ->
msg:(string, choice) Environment.env ->
key:string ->
callback:(choice -> unit) option ->
packing:(GObj.widget -> unit) option -> comboTextTree
val fromList : ?key:string ->
?callback:(choice -> unit) option ->
?packing:(GObj.widget -> unit) option ->
choices -> comboTextTree
key
(if you plan to affect some childs to this widget) and an additional callback
fonction of type choice -> unit
, which will be called every time the user will modify its selection.
You also can specify a packing function. Examples:
let colors = fromList ["red"; "blue"; "black"] ;;
let colors = fromList
~packing:(Some (dialog#table#attach ~left:2 ~top:6 ~right:4))
["red"; "blue"; "black"]
master -> slave -> slave -> ..
val fromListWithSlave : ?masterCallback:(choice -> unit) option ->
?masterPacking:(GObj.widget -> unit) option ->
choices ->
?slaveCallback:(choice -> unit) option ->
?slavePacking:(GObj.widget -> unit) option ->
(choice -> choices) ->
comboTextTree
master#slave
(slave
is simply an alias for the child number 0). Example :
let distrib = fromListWithSlave
~masterPacking: (Some (dialog#table#attach ~left:2 ~top:4 ~right:4))
["debian";"redhat";"suse"]
~slavePacking: (Some (dialog#table#attach ~left:2 ~top:5 ~right:4))
MSys.patchListOf ;;
val fromListWithSlaveWithSlave : ?masterCallback:(choice -> unit) option ->
?masterPacking:(GObj.widget -> unit) option ->
choices ->
?slaveCallback:(choice -> unit) option ->
?slavePacking:(GObj.widget -> unit) option ->
(choice -> choices) ->
?slaveSlaveCallback:(choice -> unit) option ->
?slaveSlavePacking:(GObj.widget -> unit) option ->
(choice ->
choice -> choices) ->
comboTextTree
master#slave
,
and the slave of the slave simply writing master#slave#slave
.val fromListWithSlaveWithSlaveWithSlave : ?masterCallback:(choice -> unit) option ->
?masterPacking:(GObj.widget -> unit) option ->
choices ->
?slaveCallback:(choice -> unit) option ->
?slavePacking:(GObj.widget -> unit) option ->
(choice -> choices) ->
?slaveSlaveCallback:(choice -> unit) option ->
?slaveSlavePacking:(GObj.widget -> unit) option ->
(choice ->
choice -> choices) ->
?slaveSlaveSlaveCallback:(choice -> unit) option ->
?slaveSlaveSlavePacking:(GObj.widget -> unit) option ->
(choice ->
choice ->
choice -> choices) ->
comboTextTree
master#slave
, master#slave#slave
and master#slave#slave#slave
.master / \ slave0 slave1
val fromListWithTwoSlaves : ?masterCallback:(choice -> unit) option ->
?masterPacking:(GObj.widget -> unit) option ->
choices ->
?slave1Callback:(choice -> unit) option ->
?slave1Packing:(GObj.widget -> unit) option ->
(choice -> choices) ->
?slave2Callback:(choice -> unit) option ->
?slave2Packing:(GObj.widget -> unit) option ->
(choice -> choices) ->
comboTextTree
master#slave0
and master#slave1
). This function is in this API as an exemple. See the code in order to easily
define your own comboTextTree.