Object.o
An object. See widget_arguments
for class_
, name
and props
arguments.
Registered callbacks are unregistered when object is destroyed.
method id : Stk.Oid.t
The unique id of the object.
method as_o : o
Coercion to o
.
method props : Stk.Props.t
Returns the object properties. This is not a copy and should not be modified directly except if you know what you're doing. To set a property value, use the set_*
methods provided by inheriting classes. If no such method is available for a property, you can use the set_p
method below.
method get_p : 'a. 'a Stk.Props.prop -> 'a
o#get_p p
returns value of property p
in properties of o
. If no value for p
is set in o
and p
has no default value, then Misc
.error.Missing_prop is raised.
method opt_p : 'a. 'a Stk.Props.prop -> 'a option
o#opt_p p
returns value of property p
in properties of o
, if such a value is set.
method set_p : 'a. ?propagate:bool -> 'a Stk.Props.prop -> 'a -> unit
o#set_p p v
sets value v
to property p
in properties of o
. Optional argument propagate
(defaults: false
) can be used to indicat that this change must be propagated to children objects. Class o
has no children, but inheriting classes may have and will override this method to implement propagation. The Prop_changed
event is triggered if the value of p
changed (properties are defined with a comparison function, allowing to detect a change).
method set_props : ?propagate:bool -> Stk.Props.t -> unit
o#set_props ?propagate props
calls o#set_p ?propagate
for each pair (property, value) in props
.
method connect : 'a. 'a Stk.Events.ev -> 'a -> Stk.Events.callback_id
o#connect event cb
registers cb
to be called when event
is triggered by o
. Returns a callback id which can be used to unregister the callback.
method disconnect : Stk.Events.callback_id -> unit
disconnect id
unregisters the callback with the given id
.