DomAPI Home
DomAPI

domapi.Window

See also: Elm
See also: Component

This component mimics a browser window, with these important differences:

  • Exists within your main page -- not subject to popup blockers.
  • Can be fully skinned to match your application.
  • Can behave modally, even if the browser does not support modal dialogs.
  • Can function as an MDI group.

The 'visibleButtons' constructor attribute is an integer value made up of the summation of one of more button constants. The available button constants are:

  • wbMinimize
  • wbMaximize
  • wbHelp
  • wbClose
So for example if you wanted to show the minimize, maximize and close buttons, you'd pass visibleButtons: wbMinimize + wbMaximize + wbClose

The windowType attribute defaults to "DIV", but can be any block HTMLElement type. When windowType is "IFRAME", you can use the Window.loadURL() method to set its url.


Window Example: system, aqua

Window Constructor

var window1 = domapi.Window({
  btnH                      : 14,
  btnW                      : 16,
  minH                      : 40,
  minW                      : 120,
  doModal                   : false,
  resizeBdr                 : 20,
  minimizedW                : 150,
  separatorW                : 2,
  windowType                : "DIV",
  doAllowMove               : true,
  captionAlign              : "left",
  titlePadding              : 2,
  controlsAlign             : "right",
  doAllowResize             : true,
  doManageFocus             : true,
  destroyOnClose            : true,
  doIframeShield            : true,
  doManageShield            : true,
  titleBarHeight            : 20,
  visibleButtons            : 1+2+8,
  doCreateButtons           : true,
  showContentsWhileDragging : false 
});
Also inherits the construtor arguments of Elm and Component.

Constructor Details
Parameter Type Default Description
btnH integer 14    
btnW integer 16    
minH integer 40    
minW integer 120    
doModal boolean false    
resizeBdr integer 20    
minimizedW integer 150    
separatorW integer   
windowType String DIV    
doAllowMove boolean true    
captionAlign String left    
titlePadding integer   
controlsAlign String right    
doAllowResize boolean true    
doManageFocus boolean true    
destroyOnClose boolean true    
doIframeShield boolean true    
doManageShield boolean true    
titleBarHeight integer 20    
visibleButtons integer 1+2+8    
doCreateButtons boolean true    
showContentsWhileDragging boolean false    

Events unique to domapi.Window

Methods unique to domapi.Window


Events
back to top
onbeforeclose ()

Return false to disallow the closing of the window.

back to top back to top back to top back to top back to top
onloadurl ()

Fires after the url for the window has changed (if type is IFRAME).

back to top back to top back to top back to top
onresized ()

Fires when the window is resized.

back to top back to top
Methods
allowMove ( allow )

Toggles the movability of the window. When this is false, the user cannot drag the window.

Parameters:
Parameter Type Required Default Description
allow boolean Y     
back to top
allowResize ( allow )

Sets whether or not the user is allowed to resize the window.

Parameters:
Parameter Type Required Default Description
allow boolean Y     
back to top
close ()

Removes the window from the page. If you set 'destroyOnClose' to true during construction, the window is freed from memory as well.

back to top
loadURL ( url )

If the type of window is an IFRAME, then this method can load a page into it. The site need not come from the same server, but the developer is responsible for dealing with any XSS issues.

Parameters:
Parameter Type Required Default Description
url String Y     
back to top
maximize ()

Maximizes the window. Maximized windows grow to the same proportions as their parent.

back to top
minimize ()

Minimizes the window. Minimixed windows are displayed in the lower left portion of their parent container.

back to top
open ()

If a window was previously closed (and destroyOnClose was false) then this method will restore the visibility of the window.

back to top
restore ()

Returns a maximized or minimized window to its previous dimensions.

back to top
setActive ()

Makes this window the 'active' one. Effectively this focuses the window and brings it to the front of the z-index.

back to top
setCaptionAlign ( align )

Changes the CSS alignment of the title text.

Parameters:
Parameter Type Required Default Description
align String Y   left, center, right 
back to top
setModal ( modal )

Turns the modal attribute of the window on or off. When a window is modal, the user cannot interact with any other portion of the screen.

Parameters:
Parameter Type Required Default Description
modal boolean Y     
back to top
setText ( text )

Changes the title of the window.

Parameters:
Parameter Type Required Default Description
text String Y     
back to top
showTitleBar ( show )

Hides or shows the titlebar.

Parameters:
Parameter Type Required Default Description
show boolean Y     
back to top
transferElm ( element )

Adds a given HTMLElement into the workspace of the window. Not applicable if the window is an IFRAME.

Parameters:
Parameter Type Required Default Description
element HTMLElement Y     
back to top
DHTML by www.domapi.com