Class RapidContext.Widget.Popup

Extends: RapidContext.Widget

The popup widget class. Used to provide a popup menu or information area, using a <div> HTML element. The Popup widget will automatically disappear after a configurable amount of time, unless the user performs keyboard or mouse actions related to the popup.

Source code: RapidContext_Widget_Popup.js

Class Summary
 
Creates a new popup widget.
Method Summary
 
Resets the popup auto-hide timer.
 
selectChild(indexOrNode)
Marks a popup child as selected.
 
selectMove(offset)
Moves the current selection by a numeric offset.
 
Returns the currently selected child node.
 
setAttrs(attrs)
Updates the widget or HTML DOM node attributes.
Methods borrowed from class RapidContext.Widget:
addAll, addChildNode, addClass, animate, blurAll, destroy, disable, enable, getChildNodes, hasClass, hide, isDisabled, isHidden, removeAll, removeChildNode, removeClass, setStyle, show, toggleClass, uid
Event Summary
 
Emitted when the popup is hidden.
 
Emitted when the popup is shown.
Class Detail
RapidContext.Widget.Popup(attrs)
Creates a new popup widget.
JavaScript:
var attrs1 = { value: 1, "class": "widgetPopupItem" };
var attrs2 = { value: 2, "class": "widgetPopupItem" };
var attrs3 = { value: 3, "class": "widgetPopupItem widgetPopupDisabled" };
var item1 = MochiKit.DOM.DIV(attrs1, "First Item");
var item2 = MochiKit.DOM.DIV(attrs2, "Second Item");
var item3 = MochiKit.DOM.DIV(attrs3, "Third Item");
var hr = MochiKit.DOM.HR();
var examplePopup = RapidContext.Widget.Popup({}, item1, item2, hr, item3);
User Interface XML:
<Popup id="examplePopup">
  <div value="1" class="widgetPopupItem">&#187; First Item</div>
  <div value="2" class="widgetPopupItem">&#187; Second Item</div>
  <hr />
  <div value="3" class="widgetPopupItem widgetPopupDisabled">&#187; Third Item</div>
</Popup>
Parameters:
{Object} attrs
the widget and node attributes
{Number} attrs.delay Optional
the widget auto-hide delay in milliseconds, defaults to 5000
{Object} attrs.showAnim Optional
the optional animation options when showing the popup, defaults to none
{Object} attrs.hideAnim Optional
the optional animation options when hiding the popup, defaults to none
{Boolean} attrs.hidden Optional
the hidden widget flag, defaults to true
{Widget} ... Optional
the child widgets or DOM nodes
Returns:
{Widget} the widget DOM node
Method Detail
setAttrs(attrs)
Updates the widget or HTML DOM node attributes.
Parameters:
{Object} attrs
the widget and node attributes to set
{Number} attrs.delay Optional
the widget auto-hide delay in milliseconds, defaults to 5000
{Object} attrs.showAnim Optional
the optional animation options when showing the popup, defaults to none
{Object} attrs.hideAnim Optional
the optional animation options when hiding the popup, defaults to none
{Boolean} attrs.hidden Optional
the hidden widget flag

resetDelay()
Resets the popup auto-hide timer. Might be called manually when receiving events on other widgets related to this one.

{Node} selectedChild()
Returns the currently selected child node.
Returns:
{Node} the currently selected child node, or null if no node is selected

selectChild(indexOrNode)
Marks a popup child as selected. The currently selected child will automatically be unselected by this method.
Parameters:
{Number/Node} indexOrNode
the child node index or DOM node, use a negative value to unselect
Returns:
the index of the newly selected child, or -1 if none was selected

selectMove(offset)
Moves the current selection by a numeric offset.
Parameters:
{Number} offset
the selection offset (a positive or negative number)
Returns:
the index of the newly selected child, or -1 if none was selected
Event Detail
onshow()
Emitted when the popup is shown. This event signal carries no event information.

onhide()
Emitted when the popup is hidden. This event signal carries no event information.