Class Widget.ComboTextTree.comboTextTree


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
A ComboTextTree is a combo with eventually some dependent childs (or slaves). The choice list of a node in the tree depends on the father's selected value and on the ancestors's selected values. The list of choices of a node is given dynamically by a function called the generator which is used to calculte or recalculate the choice list.

Constant fields (methods)

method generator : (string, string) Environment.env -> string list
The function to build or rebuild the choices using the given environnement. For a simple comboTextTree, this method is used only at the creation and the function is not really dependent from its argument, but it is a simple costant function.
method key : string
The key of the pair (key,value) which this widget (node) eventually transmit to its childs (slaves). This field is set at the creation. The value of the pair (key,value) will be the selected value of the widget, of course.
method callback : string -> unit
A secondary function to call at any change of the selected item. This represent an additional callback. The principal callback is the method childs_rebuild which propagate the selected value to all childs.
method packing : GObj.widget -> unit
The function to call to attach self somewhere. For instance :
 packing = dialog#table#attach ~left:1 ~top:2 ~right:3 
Every time the comboTextTree is rebuilded, the old box is destroyed, rebuilded and finally repackaged with this packing function.

Variable fields

val mutable env : (string, string) Environment.env
This fields stores the environment used for the last generation of the choice list. This information is fundamental because if this widget has some ancestors and also some descendents, for any alteration of its state, it must resend to its childs the last environment received from its ancestors enriched with the pair (key,value) representing its own state. In this way, every descendent know the state of all its ancestors (not only the state of its father).
val mutable choices : string list
The choices calculated by the last call to the generator.
val mutable box : GEdit.combo_box
The currently encapsulated GEdit.combo_box.
val mutable col : string GTree.column
val mutable childs : comboTextTree list
The childs list of this widget.

Accessors

method env : (string, string) Environment.env
method choices : string list
method box : GEdit.combo_box
method col : string GTree.column
method childs : comboTextTree list
method child : int -> comboTextTree

Convenient aliases

method slave : comboTextTree
method slave0 : comboTextTree
method slave1 : comboTextTree
method slave2 : comboTextTree
method slave3 : comboTextTree
method slave4 : comboTextTree
method slave5 : comboTextTree

Fixing variable fields

method set_env : (string, string) Environment.env -> unit
method set_choices : string list -> unit
method set_box : GEdit.combo_box -> unit
method set_col : string GTree.column -> unit
method set_childs : comboTextTree list -> unit
method add_child : comboTextTree -> unit

Selected item

method selected : string
In the most cases, the only interesting method from an abstract point of view.
Returns the selected string belong the combo items
method set_active_value : string -> unit
Set the current active (selected) choice by its value (instead of its index)

Rebuilding self and childs

method childs_rebuild : unit -> unit
Demands to all childs to rebuild theirself and their childs and so on. This procedure is performed sending to all childs the ancestor environment (method env) enriched by the pair (key,value), where value is the current selected item of this node.
method rebuild : (string, string) Environment.env -> unit
Rebuild this widget, and its eventually all childs, with the new given environment.