UI/ EventManager.js

This library attempts to abstract events so that many controls can use, say, mouse down for example, instead of taking total control of the event The main point of this library is to delegate events to controls that care.  Often times, DHTML contorls (tree controls for instance) will take hold of the document on click event, and then no other contorl or process can get that event.  This library takes control of the events then allows you to register with it so that everyone can get notified in turn.  To register, make a function that takes one parameter.  The parameter will be the event object, and will get passed in by the manager to your function when the event gets fired.  So for example the following code creates an alert box when anything on the page is clicked

click_happened = function(event){ alert(event.target) };
neuro_addClickListener(click_happened);

The event object has a few tweaks to make it act the same on all browsers, but the most common part of the event is the target property which points to the item that fired the event.

Copyright

2004-2006 Rob Rohan (robr.nosp@m.ohan@gmai.nosp@m.l.com) All rights reserved

Related

Util/Browser.js

Summary
This library attempts to abstract events so that many controls can use, say, mouse down for example, instead of taking total control of the event The main point of this library is to delegate events to controls that care.
Allows delegation of browser events (key press, mouse move, etc) so any process can be notified of an event.
all the load listeners
array of click listeners
all the mouse down listeners
mouse up listeners
array of mouse move listeners
key down listeners
key up listeners
key press listeners
Link the event manager to a document.
register an onload listner
register a mouse down listener
register a mouse up listener
register a click listener
register a move listener
add a keyDownListener
add a keyUpListener
add a key press Listener
Gets the key code from an event i.e.
Gets the key from an event i.e.
the current version

EventManager

Allows delegation of browser events (key press, mouse move, etc) so any process can be notified of an event.  Simply add a listener using one fo the Add functions.  A listener is a function that takes a single parameter.  When called the passed parameter will be the event object.

Namespace

Sortie.UI

Summary
all the load listeners
array of click listeners
all the mouse down listeners
mouse up listeners
array of mouse move listeners
key down listeners
key up listeners
key press listeners
Link the event manager to a document.
register an onload listner
register a mouse down listener
register a mouse up listener
register a click listener
register a move listener
add a keyDownListener
add a keyUpListener
add a key press Listener
Gets the key code from an event i.e.
Gets the key from an event i.e.
the current version

Variables

EventManager. onloadListeners

all the load listeners

EventManager. clickListeners

array of click listeners

EventManager. mdownListeners

all the mouse down listeners

EventManager. mupListeners

mouse up listeners

EventManager. moveListeners

array of mouse move listeners

EventManager. keyDownListeners

key down listeners

EventManager. keyUpListeners

key up listeners

EventManager. keyPressListeners

key press listeners

Functions

EventManager.Init

Link the event manager to a document.  Often this is simply

var em = new Sortie.UI.EventManager();
em.Init(document);

Parameters

docuthe document to handle events for

EventManager. AddLoadListener

register an onload listner

Parameters

functhe call back function to run when this event occurs

EventManager. AddMouseDownListener

register a mouse down listener

Parameters

functhe call back function to run when this event occurs

EventManager. AddMouseUpListener

register a mouse up listener

Parameters

functhe call back function to run when this event occurs

EventManager. AddClickListener

register a click listener

Parameters

functhe call back function to run when this event occurs

EventManager. AddMoveListener

register a move listener

Parameters

functhe call back function to run when this event occurs

EventManager. AddKeyDownListener

add a keyDownListener

Parameters

functhe call back function to run when this event occurs

EventManager. AddKeyUpListener

add a keyUpListener

Parameters

functhe call back function to run when this event occurs

EventManager. AddKeyPressListener

add a key press Listener

Parameters

functhe call back function to run when this event occurs

EventManager. __normalizeEvent

helper function to handle IE bug for even handlingmostly makes just makes sure an event is an event.  Not really an API function but it might be useful out side this library.

Parameters

evtan event (could be IE could be Mozilla)

Returns

a uniform event object

EventManager. GetKeyCodeFromEvent

Gets the key code from an event i.e.  65

Parameter

evtthe event to get the key code from

Returns

the ascii key code

EventManager. GetKeyFromEvent

Gets the key from an event i.e.  “A”

Parameters

evtthe event in which to look

Returns

char from a key event

Variables

Sortie. Util. EventManager. VERSION

the current version