wxEvtHandler
(wx)The Event handler.
The Event handler.
To get events from wxwidgets objects you subscribe to them by calling connect/[2-3]. Events are sent as messages, if no callback was supplied These messages will be #wx{} where EventRecord is a record that depends on the event type. The records are defined in: wx/include/wx.hrl.
If a callback was supplied to connect, the callback will be invoked (in another process) to handle the event. The callback should be of arity 2. fun(EventRecord::wx(), EventObject::wxObject()).
Beware that the callback will be in executed in new process each time.
Functions
connect(This::wxEvtHandler(), EventType::wxEventType()) -> ok
Equivalent to connect(This, EventType, [])
connect(This::wxEvtHandler(), EventType::wxEventType(), Options::[Option]) -> ok
Option = {id, integer()} | {lastId, integer()} | {skip, boolean()} | callback | {callback, function()} | {userData, term()}
This function subscribes the to events of EventType, in the range id, lastId. The events will be received as messages if no callback is supplied.
Options: {id, integer()}, The identifier (or first of the identifier range) to be associated with this event handler. Default ?wxID_ANY {lastId, integer()}, The second part of the identifier range. If used 'id' must be set as the starting identifier range. Default ?wxID_ANY {skip, boolean()}, If skip is true further event_handlers will be called. This is not used if the 'callback' option is used. Default false. {callback, function()} Use a callback fun(EventRecord::wx(), EventObject::wxObject()) to process the event. Default not specfied i.e. a message will be delivered to the process calling this function. {userData, term()} An erlang term that will be sent with the event. Default: [].
disconnect(This::wxEvtHandler()) -> boolean()
Equivalent to disconnect(This, null, []) Can also have an optional callback Fun() as an additional last argument.
disconnect(This::wxEvtHandler(), EventType::wxEventType()) -> boolean()
Equivalent to disconnect(This, EventType, [])
disconnect(This::wxEvtHandler(), EventType::wxEventType(), Opts::[Option]) -> boolean()
Option = {id, integer()} | {lastId, integer()} | {callback, function()}
See