Simple Mode Example
This is a simple example of a "fragile" mode.
Clicking anywhere else will release the mode.
You can click on a button and the event
will be sent to that button. This is done by
returning true from passModeEvent.
close
//debug.write("passModeEvent", event_name, view);
if (event_name == "onmousedown") {
this.close();
}
return true;
LzModeManager.makeModal( this );
this.bringToFront();
parent.bringToFront();
this.setAttribute('visible', true);
LzModeManager.release( this );
setAttribute('visible', false);
complex mode example:this could be some helpful text to tell you how to
fill in this fieldmore information about how to fill
out this field could go into this expanded area
if (isvisible) {
more.setVisible(true);
this.setHeight(50);
}
type something here
//debug.write('onfocus', this);
this.open();
if (!this.isopen) {
this.isopen=true;
tip.setVisible(true);
LzModeManager.makeModal( this );
if (typeof(this.tabDel) == "undefined") {
this.tabDel = new LzDelegate( this , "releaseMode" );
this.clickDel = new LzDelegate( this , "checkForClick" );
}
this.tabDel.register(LzKeys, "onkeydown");
this.clickDel.register(LzGlobalMouse, "onmouseup");
}
if (this.isopen) {
this.isopen = false;
tip.setVisible(false);
LzModeManager.release( this );
this.tabDel.unregisterAll();
}
this.clickDel.unregisterAll();
0 && xpos < this.width && ypos > 0 && ypos < this.height) {
this.open();
}
]]>
//Debug.write("passModeEvent", event_name, view);
if (event_name == "onmousedown") {
this.close();
}
return true;
//debug.write('releaseMode', kc);
if (kc == 9) { // tab
this.close();
}
Use these views to test key and mouse eventsinput text (A)input text (B)selectable text (C)focusable viewyellow=has focus
setBGColor(0xffff00);
setBGColor(0xffffff);
Mouse Event Tester
this.mytext.setText( t );
-- global mouse event tester --
new LzDelegate( this , "globalMouseUp" , LzGlobalMouse ,
"onmouseup" );
new LzDelegate( this , "globalMouseDown" , LzGlobalMouse,
"onmousedown" );
new LzDelegate( this , "globalMouseRollover" , LzGlobalMouse ,
"onmouseover" );
this.cleard = new LzDelegate( this , "cleartext" )
this.setText( "mouseup from " + vc );
LzTimer.resetTimer( this.cleard , 3000 );
this.setText( "mousedown from " + vc );
this.setText( "mouse over " + vc );
LzTimer.resetTimer( this.cleard , 3000 );
this.setText( "" );
note: the LzGlobalMouse service continues to send events
even when someone has the mode, but only the view which
has the mode receives view events
LzModeManager.makeModal( this );
this.setVisible( true );
this.bringToFront();
LzFocus.setFocus(this);
this.setVisible( false );
LzFocus.setFocus(null);
LzModeManager.release( this );
//debug.write("passModeEvent", event_name, view);
return false;
Mouse events only go to the dialog view and its
children, because it returns false from passModeEvents.
The dialog also sets focustrap="true" so that focus is kept
within this view.
This simple dialog is declared on the canvas so that
it will float above all other views. Alternately, a class
can be created from script with its parent as the canvas.
test tabbing here:input text oneinput text twoselectable text
simple example to show that modes may be nested