wxEvtHandler

wxEvtHandler

wxEvtHandler
Functions for wxEvtHandler class

A class that can handle events from the windowing system. wxWindow is (and therefore all window classes are) derived from this class.

To get events from wxwidgets objects you subscribe to them by calling connect/3.

If the callback option is not supplied events are sent as messages.

These messages will be #wx{} where EventRecord is a record that depends on the wxEventType. 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 Callback (EventRecord::wx(), EventObject::wxObject()).

Note: The callback will be in executed in new process each time.

See: Overview events

wxWidgets docs: wxEvtHandler

Types

Option =
    {id, integer()} |
    {lastId, integer()} |
    {skip, boolean()} |
    callback |
    {callback, function()} |
    {userData, term()}

This function subscribes to events.

Subscribes to events of type EventType, in the range id, lastId.

The events will be received as messages if no callback is supplied.

Options

id:{id, integer()} The identifier (or first of the identifier range) to be associated with this event handler. Default is ?wxID_ANY

lastid:{lastId,integer()} The second part of the identifier range. If used 'id' must be set as the starting identifier range. Default is ?wxID_ANY

skip:{skip,boolean()} If skip is true further event_handlers will be called. This is not used if the 'callback' option is used. Default is false.

callback:{callback,function()} Use a callbackfun(EventRecord::wx(),EventObject::wxObject()) to process the event. Default not specified i.e. a message will be delivered to the process calling this function.

userData:{userData,term()} An erlang term that will be sent with the event. Default: [].

Types

Option =
    {id, integer()} | {lastId, integer()} | {callback, function()}

This function unsubscribes the process or callback fun from the event handler.

EventType may be the atom 'null' to match any eventtype. Notice that the options skip and userdata is not used to match the eventhandler.