• download
  • documentation
  • forums
  • demo
  • contact
  • blog

meteora

javascript widgets

Documentation

  • Autocomplete
  • Bubble
  • Calendar
  • Carousel
  • Datagrid
  • Dialog
  • Editor
  • Effect
  • Filebrowser
  • Form
  • Jsonrpc
  • Menu
  • Notebook
  • Picbox
  • Popup
  • Searchlist
  • Selection
  • Spinbutton
  • Tablesort
  • Toolbox
  • Treeview

What does this control do?

This control can be used to create custom modal windows. You can also use one of our predefined dialogs such as those we use to replace the ugly-by-default alert() or prompt() calls.

For an usage example check out the Meteora.Dialog demo.

How to use

In order to use this control, paste this line of javascript right at the beginning of your script tag:

Meteora.uses('Meteora.Dialog');

You may then be able to invoke any of our predefined Dialog such as Dialog.alert(), Dialog.prompt() or Dialog.question().

Dialog.alert(
  'This is an emergent message.',
  {
    'title': 'Dialog title'
  }
);
Dialog.prompt(
  'What is your name?',
  {
    'title': 'Dialog title',
    'onOk': function(dialog) {
     
      var yourName = this.value;
      myNameIs(yourName);
      dialog.close();
    }
  }
);
Dialog.question(
  'Are you sure?',
  {
    'title': 'Dialog title',
    'onYes': function(dialog) {
      YesIAmSure();
      dialog.close();
    },
    'onNo': function(dialog) {
      noIAmNot();
      dialog.close();
    }
  }
);

This is a classic dialog using common form elements expecting for user interaction:

var dialog = new Dialog(
 
  // CONTENT
  // You can use some text or an HTML element's reference
  'Dialog inner content',
  // OPTIONS
  {
    // WINDOW'S TITLE
    'title': 'Dialog title',
   
    // FORM BUTTONS
    'buttons': {
     
      // Cancel button
      'buttonCancel': {
        'caption': 'Cancel',
        'onClick': function(dialog) {
          dialog.close();
        }
      },
      // OK button
      'buttonOk': {
        'caption': 'OK',
        // This is the default button
        'default': true,
        'onClick': function(dialog) {
          dialog.close();
        }
      }
      // You can continue adding buttons if you want
    }
  }
);
// Centering the dialog
dialog.center();
dialog.show();

If you want to create a complete customized dialog, you can pass an HTML element's reference to the contructor:

new Dialog(HTMLElementReference);

Methods

center()

Places the dialog at the center of the screen.

top()

Moves the dialog to the topmost edge of the screen.

left()

Moves the dialog to the leftmost edge of the screen.

right()

Moves the dialog to the rightmost edge of the screen.

bottom()

Moves the dialog to the bottom edge of the screen.

moveTo(x, y)

Moves the dialog x pixels from the top and y from the left of the browser's window.

resizeTo(width, height)

Changes the size of the modal window to x (width) and y (height).

focus()

Sets the modal window as active.

blur()

Sets the modal window as inactive.

hide()

Hides the modal window.

show()

Shows the modal window.

close()

Destroys the modal window and removes all its contents from memory.

setTitle(title)

Changes the title of the modal window to title.

setContent(content)

Puts content inside modal window (text string, HTML string or HTML element's reference).

Copyright © 2007-2009 Astrata Software.