<<<<<<<<<<<<<<<<<

inputcontroller(lymb) LYMB inputcontroller(lymb)

NAME

inputcontroller

SUPERCLASS

object

DESCRIPTION

The inputcontroller controls a finite state machine (fsm) and accepts events that govern the actions of the fsm.

INSTANCE VARIABLES

enabled is a boolean. If set, the controller will accept events. If not set, it ignores them.

state is a string indicating the current fsm state.

error_action is a string indicating the action (if any) to execute when unknown events are received.

ignore_unknown_events is a boolean. If set, events not recognized will be discarded.

event is a pointer to an event object. It holds the information about the last event received.

MESSAGES

transition+ (current,event,next,action) Define a state transition. Current and next are names of states. Event is the name of an event object template. Action is the name of an actions object. (It can be the empty string.)

transition- (current,event) Delete a state transition. Current is the name of a state. Event is the name of an event object template.

start! Tell the controller to start accepting events.

stop! Tell the controller to stop accepting events.

unknown_input: event When an inputnode object can't match an event, it is returned to the controller as the argument of an unknown_input: message. If unknown events are ignored, it is discarded. If not, a message is displayed or the error_action is invoked (if defined).

event: event This message accepts a string name representing an event. An event object is constructed, then

forwarded to the inputnode object representing the current state. If the state is not set or the controller is not enabled, the event is ignored.

x? is delegated to the event instance variable.

y? is delegated to the event instance variable.

button? is delegated to the event instance variable.

key? is delegated to the event instance variable.

type? is delegated to the event instance variable.

window? is delegated to the event instance variable.

push! pushes the state stack. The usual way to use push! and pop! are to include a transition that has the same current and next state, and let the action object do the pushing or popping and state changing.

pop! pops the state stack. The usual way to use push! and pop! are to include a transition that has the same current and next state, and let the action object do the pushing or popping and state changing.

EXAMPLE

See the xeventcontroller manual page.

SEE ALSO

inputcontroller, inputnode, event


Please send comments and suggestions to
consult@rpi.edu