package stk

  1. Overview
  2. Docs

Events and callback registration.

The event type ev is an extensible type. Some basic events are defined in Widget, others are specific to some widgets and are defined in the corresponding modules (for example in Clist or Textbuffer). Code using the Stk library can add its own events, then use trigger* methods in Object.o to trigger events and the callback registration mecanism below (or through the connect and disconnect methods of Object.o).

type callback_id
type _ ev = ..
val register : Oid.t -> 'a ev -> 'a -> callback_id

register o ev cb registers cb as callback when event ev is trigged on object o. The returned callback id can be used to unregister the callback.

val get : Oid.t -> 'a ev -> 'a list

get o ev returns the list of callbacks associated to event ev on object o.

val unregister : callback_id -> unit

unregister id unregister the callback associated to id.

OCaml

Innovation. Community. Security.