Name

LzGlobalMouse — Application-wide control of and information about the mouse.

Synopsis

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

Description

The LzGlobalMouse service sends events any time the mouse button state changes, even if mouse events are locked using the LzModeManager API. The LzGlobalMouse is also useful for detecting when the mouse button goes up or down on a non-clickable view.

 <canvas height="100">
   <simplelayout inset="10" spacing="10"/>
 
   <checkbox>Lock mouse events
     <handler name="onvalue">
       if (this.value){
         
       } 
     </handler>
 
     <handler name="onclick" reference="LzGlobalMouse" args="who">
       <![CDATA[ 
       //need to use LzGlobalMouse, since we don't get clicks if we're
       //checked. NB that LzGlobalMouse sends its events before the view
       //receives the events, so we can just unlock it here, and the
       //checkbox can do its normal onclick handling.
       if (this.value && who == this){
         
       }
       ]]>
     </handler>
   </checkbox>
 
   <button>click me!</button>
 
   <text resize="true">
     <method name="showEvent" args="what, who">
       this.setText(what +": " + who);
     </method>
 
     <handler name="onmouseover" reference="" args="who">
       this.showEvent("mouseover" , who);
     </handler>
     <handler name="onmouseout" reference="" args="who">
       this.showEvent("mouseout" , who);
     </handler>
 
     <handler name="onmousedown" reference="" args="who">
       this.showEvent("mousedown" , who);
     </handler>
     <handler name="onmouseup" reference="" args="who">
       this.showEvent("mouseup" , who);
     </handler>
 
     <handler name="onclick" reference="" args="who">
       this.showEvent("mouseclick" , who);
     </handler>
   </text>
 </canvas>
 

Use the LzGlobalMouse service in conjunction with LzModeManager's event lock.

Development Note

The global mouse service sends onmouse*** and onclick events when the mouse rollover or button state changes. The argument sent with the events is the view that was clicked. If no view was clicked, the argument is null.

Details

Static Methods (1)

__mouseEvent()
static private function __mouseEvent(eventname, view);

Static Events (3)

onmousedown
static public event onmousedown;
onmousemove
static public event onmousemove;
onmouseup
static public event onmouseup;

JavaScript Synopsis

public var LzGlobalMouse = { ... };