<alert>
A simple alert.

JavaScript: lz.alert

A simple subclass of <modaldialog>, <alert> provides a modal alert box that displays its text attribute (or content) and an OK button. (If you need to display more than text in an alert, use <modaldialog> itself).

<canvas height="140">
        <alert name="myalert">
            Danger! Danger, Will Robinson!
        </alert>
        
        <button onclick="canvas.myalert.open()">Show Alert</button>
    </canvas>

See also:

Attributes

Name (CSS property) Type (tag) Type (js) Default Category
button1 string String OK read/write
  Alert shows only this button, if button2 isn't set. You may specify a different string to change the text of the button.
button2 string String   read/write
  If a string is set for this attribute, a second button will be shown to the left of the first with this text.
maxtextwidth expression any Math.round(parent.width/3) - inset_left - inset_right - content_inset_left - content_inset_right read/write
  The max length of a line of text before it wraps. Default: 1/3 of the parent's width - width of window dressing and margin.
minwidth expression any button2 == '' ? 100 : 170 initialize-only
  Minimum width for the alert. Default: 100 for a 1 button alert, 170 for a 2 button alert.
result expression any null read/write
  After the alert is closed, this is set to true if button1 ("OK") is pressed or false if button2 is pressed. You can check for the result value using the onresult event.
text_x number Number 0 read/write
  The x position of the button text.
text_y number Number 0 read/write
  The y position of the button text.

Methods

close()
alert.close(args : Boolean);
Closes the alert window. This method is used by the alert button(s). If button1 is clicked, close is passed a true value. If button2 is clicked, close is passed a false value.
Parameter Name Type Description
args Boolean a boolean result value.

open()
alert.open();
Opens the alert window.

Methods inherited from <modaldialog>

close, open

Methods inherited from <basewindow>

close, open, setWindowFocus

Methods inherited from lz.Eventable

destroy, setAttribute

Events

Name Description
onresult This event is sent when a button is pressed. Use this to check the result value.

Events inherited from <node>

onconstruct, ondata, oninit

Events inherited from lz.Eventable

ondestroy