<alert>

A simple alert.

JavaScript: alert

Extends Modaldialog

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 Usage Type (Tag) Type (JS) Default Category
button1 Tag & JS string String OK setter
 

Alert shows only this button, if button2 isn't set. Default: "OK". You may specify a different string to change the text of the button.


button2 Tag & JS string String   setter
 

If a string is set for this attribute, a second button will be shown to the left of the first with this text.


maxtextwidth Tag & JS expression any   setter
 

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.


onresult Tag & JS expression any   setter
 

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


result Tag & JS expression any null setter
 

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 Tag & JS number Number 0 setter
 

The x position of the button text. Default: 0 (left).


text_y Tag & JS number Number 0 setter
 

The y position of the button text. Default: 0 (top).



Attributes inherited from Basecomponent

doesenter, enabled, hasdefault, isdefault, style, styleable, text

Attributes inherited from Basewindow

allowdrag, datacontrolsvisibility, haswindowfocus, minheight, minwidth, state

Attributes inherited from Modaldialog

content_inset_bottom, content_inset_left, content_inset_right, content_inset_top

Attributes inherited from Node

class, classroot, cloneManager, datapath, id, ignoreAttribute, ignoreplacement, immediateparent, initstage, name, nodeLevel, onconstruct, oninit, parent, placement, subnodes

Attributes inherited from View

aaactive, aadescription, aaname, aasilent, aatabindex, align, bgcolor, clickable, clickregion, clip, cursor, defaultplacement, fgcolor, focusable, focustrap, font, fontsize, fontstyle, frame, framesloadratio, hassetheight, hassetwidth, height, layout, loadratio, mask, onblur, onclick, ondata, ondblclick, onfocus, onkeydown, onkeyup, onmousedown, onmouseout, onmouseover, onmouseup, onselect, opacity, options, pixellock, play, resource, resourceheight, resourcewidth, rotation, selectiontype, showhandcursor, source, stretches, subviews, totalframes, unstretchedheight, unstretchedwidth, valign, visible, width, x, xoffset, y, yoffset

Attributes inherited from Windowpanel

closeable, inset_bottom, inset_left, inset_right, inset_top, title, titlearea_inset_top


Methods

close()
alert.close(res)

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.

Parameters
Name Type Desc
res Boolean a boolean result value.


open()
alert.open()

Opens the alert window.



Methods inherited from basecomponent

doEnterDown, doEnterUp, doSpaceDown, doSpaceUp, setStyle, setTint, updateDefault

Methods inherited from basewindow

bringToFront, sendBehind, sendInFrontOf, sendToBack, setVisible, setWindowFocus

Methods inherited from LzNode

animate, applyConstraint, applyData, childOf, completeInstantiation, createChildren, dataBindAttribute, destroy, determinePlacement, getAttribute, getOption, getUID, lookupSourceLocator, searchImmediateSubnodes, searchSubnodes, setAttribute, setDatapath, setID, setName, setOption

Methods inherited from LzView

addProxyPolicy, addSubview, construct, containsPt, getAttributeRelative, getBounds, getColor, getColorTransform, getContextMenu, getCurrentTime, getDepthList, getHeight, getID3, getMouse, getPan, getTotalTime, getVolume, getWidth, init, measureHeight, measureWidth, play, releaseLayouts, removeProxyPolicy, searchParents, searchSubviews, seek, setAAActive, setAADescription, setAAName, setAASilent, setAATabIndex, setAlign, setAttributeRelative, setBGColor, setClickable, setColor, setColorTransform, setContextMenu, setCursor, setHeight, setLayout, setOpacity, setPan, setPlay, setResource, setResourceNumber, setRotation, setShowHandCursor, setSource, setValign, setVolume, setWidth, setX, setY, shouldYieldFocus, stop, stretchResource, unload, updateResourceSize

Methods inherited from modaldialog

close, open


Events

Events inherited from LzNode

onconstruct, ondata, oninit

Events inherited from LzView

onaddsubresource, onaddsubview, onblur, onclick, ondblclick, onerror, onfocus, onframe, onheight, onlastframe, onload, onmousedown, onmousedragin, onmousedragout, onmouseout, onmouseover, onmouseup, onmouseupoutside, onopacity, onplay, onremovesubview, onstop, ontimeout, onwidth, onx, ony