Name

LzModeManager — Controls pass-through of mouse events.

Synopsis

JavaScript: LzModeManager
Type: Object
Access: public
Topic: LFC.Services
Declared in: WEB-INF/lps/lfc/services/LzModeManager.lzs

Description

The mode manager controls the dispatch of mouse events to the rest of the system. The mode manager keeps a stack of modal views. When a view is made modal (with the call makeModal()) only it and its children receive mouse events.

In the example below, the window grabs the mode when it is opened and releases it when it is closed. Note that the button no longer responds to mouse examplesses after the window is made modal, but the children of the window (such as the close button and the drag bar) still do. For a more detailed example of using modes with Laslzo, see modeexample.lzx in the examples directory.

Example 15. Using the mode manager to make a window behave like a modal dialog

 <canvas height="160">
   <button name="b1" onclick="winDia.openWindow()">Show modal dialog</button>
   <window width="200" name="winDia" closeable="true" visible="false"
           x="150" title="modal dialog">
 
     <method name="openWindow">
       this.open();
       LzModeManager.makeModal(this);
     </method>
     <method name="close">
       LzModeManager.release(this);
       super.close();
     </method>
   </window>
 
 </canvas> 
 

Development Note

Manages the modal states of views and also notifies views ( that have registered with it ) when their focus has changed.

Details

Static Properties (5)

eventsLocked
static public var eventsLocked = false;
__LZlastclick
static private var __LZlastclick = null;
modeArray
static public var modeArray = { ... };
onmode
static public var onmode = null;
willCall
static public var willCall = false;

Static Methods (13)

__findInputtextSelection()
static private function __findInputtextSelection();
Finds the view for if the mouse event occurred in an input text field TODO: implement
getModalView()
static private function getModalView();
globalLockMouseEvents()
static public function globalLockMouseEvents();
Prevents all mouse events from firing.
globalUnlockMouseEvents()
static public function globalUnlockMouseEvents();
Restore normal mouse event firing.
handleMouseButton()
static public function handleMouseButton(view, eventName);
handleMouseEvent()
static private function handleMouseEvent(view : LzView, eventStr : String);
Check to see if the current event should be passed to its intended view
hasMode()
static public function hasMode(view : LzView) : Boolean;
Tests whether the given view is in the modelist.
__LZallowFocus()
static private function __LZallowFocus(view);
return true if the given view is allowed to receive the focus any view that is a child of the view that has the mode may be focused other views may not
makeModal()
static public function makeModal(view : LzView);
Pushes the view onto the stack of modal views
rawMouseEvent()
static public function rawMouseEvent(me);
release()
static public function release(view : LzView);
Removes the view (and all the views below it) from the stack of modal views
releaseAll()
static public function releaseAll();
Clears all modal views from the stack
toString()
static public function toString();

JavaScript Synopsis

public var LzModeManager = { ... };