Name

Return Value

Description

SK.App.Popup( )



 

Constructor

Designed to work within application popup windows where the properties_add, properties_edit, and control_panel binding code is executed.

The library is available in all application popups — property sheets and control panel.

setTitle( title )

this

Sets a title to the popup window

close( )

this

Closes the window

resize( width, height )

this

Resizes the popup to the given dimensions.

createButton({
   "caption": "button caption",
   "callback": function( ) {...},
   "class": "optional CSS class"
})

DOM element which can be injected on a desired place in the document.

Creates a standard WebForce system page button.

confirm(
   "message...",
   callback_ok,
   callback_cancel,
   {
      width: <width>,
      height: <height>
   }
)


 

Creates a confirmation dialog with OK and Cancel buttons. The callback_ok is executed when OK is clicked. The callback_cancel is executed when Cancel is clicked.

notice(
   "message...",
   callback_ok,
   {    
      width: <width>,
      height: <height>
   }
)

 

Creates a notification dialog. The callback_ok is executed when OK is clicked.

syncEncoding( )

 

Gets the encoding from the opener window and sets it in the popup

 

Examples
Creating a [Close] button and injecting it into a placeholder with buttons.

<script type="text/javascript">
   _$( window ).addEvent( 'load', function( ) {
      var popup = new SK.App.Popup( );
      var close_button = popup.createButton({
         caption: "Close",
         callback: function( ) {
            this.close();
         }.bind( popup )
      });
            
      // Put it in the placeholder with buttons
      close_button.inject( _$( "buttons" ) );
   });
</script>
<div class="buttons-box" id="buttons"></div>


Resizing the popup and setting a new title.

<script type="text/javascript">
   var popup = new SK.App.Popup()
   popup.setTitle( "Configuration Options" )
   popup.resize( 800, 500 );
</script>


Displaying a confirmation box.

<script type="text/javascript">
   var popup = new SK.App.Popup( );
   popup.confirm(
      "Are you sure you want to delete this item?",
      function( ) {
         // MyApp.delete( );
      },
     
function () {},    // In case there's nothing to do on [Cancel] click
            { width: 300, height: 150 }
   );
</script>