Clear Up
SharpKit Reference

MessageBox Class

Namespace: Ext

Base Types

System.Object

Methods

Name Description
alert(JsString, JsString, JsAction, object) Displays a standard read-only message box with an OK button (comparable to the basic JavaScript alert prompt). If a callback function is passed it will be called after the user clicks the button, and the itemId of the button that was clicked will be passed as the only parameter to the callback. * @param {String} title The title bar text @param {String} msg The message box body text @param {Function} fn The callback function invoked after the message box is closed @param {Object} [scope] The scope (`this` reference) in which the callback is executed. Defaults to the browser window. @return {Ext.MessageBox} this
applyMsg(object) @private
applyPromptConfig(object) @private
applyTitle(object) Creates a new {@link Ext.Toolbar} instance using {@link Ext.Factory} @private
confirm(JsString, JsString, JsAction, object) Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm). If a callback function is passed it will be called after the user clicks either button, and the id of the button that was clicked will be passed as the only parameter to the callback (could also be the top-right close button). * @param {String} title The title bar text @param {String} msg The message box body text @param {Function} fn The callback function invoked when user taps on the OK/Cancel button. The button is passed as the first argument. @param {Object} [scope] The scope (`this` reference) in which the callback is executed. Defaults to the browser window. @return {Ext.MessageBox} this
onClick(object)
prompt(JsString, JsString, JsAction, object, object, JsString, object) Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user clicks either button, and the id of the button that was clicked (could also be the top-right close button) and the text that was entered will be passed as the two parameters to the callback. * Example usage: * Ext.Msg.prompt( 'Welcome!', 'What\'s your name going to be today?', function(value){ console.log(value) }, null, false, null, { autocapitalize : true, placeholder : 'First-name please...' } ); * @param {String} title The title bar text @param {String} msg The message box body text @param {Function} fn The callback function invoked when the user taps on the OK/Cancel button, the button is passed as the first argument, the entered string value is passed as the second argument @param {Object} [scope] The scope (`this` reference) in which the callback is executed. Defaults to the browser window. @param {Boolean/Number} [multiLine=false] True to create a multiline textbox using the defaultTextHeight property, or the height in pixels to create the textbox. @param {String} [value=''] Default value of the text input element. @param {Object} [promptConfig] A hash collection of input attribute values. * @param {Boolean} [promptConfig.focus=false] True to assert initial input focus. * @param {String} [promptConfig.placeholder=''] String value rendered when the input field is empty. * @param {String/Boolean} [promptConfig.autocapitalize='off'] True/on to capitalize the first letter of each word in the input value. * @param {String/Boolean} [promptConfig.autocorrect='off'] True/on to enable spell-checking/autocorrect features if supported by the browser. * @param {String/Boolean} [promptConfig.autocomplete='off'] True/on to enable autoCompletion of supplied text input values if supported by the browser. * @param {Number} [promptConfig.maxlength=0] Maximum number of characters allowed in the input if supported by the browser. * @param {String} [promptConfig.type='text'] The type of input field. Possible values (if supported by the browser) may include (text, search, number, range, color, tel, url, email, date, month, week, time, datetime) (defaults to 'text') * @return {Ext.MessageBox} this
show(object) Displays a new message box, or reinitializes an existing message box, based on the config options passed in. All display functions (e.g. prompt, alert, etc.) on MessageBox call this function internally, although those calls are basic shortcuts and do not support all of the config options allowed here. * Example usage: * Ext.Msg.show({ title: 'Address', msg: 'Please enter your address:', width: 300, buttons: Ext.MessageBox.OKCANCEL, multiLine: true, prompt : { maxlength : 180, autocapitalize : true }, fn: saveAddress, iconCls: Ext.MessageBox.INFO }); * @param {Object} config An object with the following config options: * @param {Object/Array} [config.buttons=false] A button config object or Array of the same(e.g., `Ext.MessageBox.OKCANCEL` or `{text:'Foo', itemId:'cancel'}`), or false to not show any buttons. * @param {String} config.cls A custom CSS class to apply to the message box's container element. * @param {Number} [config.defaultTextHeight=75] The default height in pixels of the message box's multiline textarea if displayed. * @param {Function} config.fn A callback function which is called when the dialog is dismissed by clicking on the configured buttons. @param {String} config.fn.buttonId The itemId of the button pressed, one of: 'ok', 'yes', 'no', 'cancel'. @param {String} config.fn.value Value of the input field if either `prompt` or `multiline` option is true. @param {Object} config.fn.opt The config object passed to show. * @param {Number} [config.width='auto'] A fixed width for the MessageBox. * @param {Number} [config.height='auto'] A fixed height for the MessageBox. * @param {Object} config.scope The scope of the callback function * @param {String} [config.icon=''] A CSS class that provides a background image to be used as the body icon for the dialog (e.g. Ext.MessageBox.WARNING or 'custom-class'). * @param {Boolean} [config.modal=true] False to allow user interaction with the page while the message box is displayed. * @param {String} config.msg A string that will replace the existing message box body text. Defaults to the XHTML-compliant non-breaking space character ` `. * @param {Boolean} [config.multiline=false] True to prompt the user to enter multi-line text. * @param {Boolean} [config.prompt=false] True to prompt the user to enter single-line text (defaults to false) * @param {String} config.title The title text. * @param {String} config.value The string value to set into the active textbox element if displayed. * @return {Ext.MessageBox} this
updateButtons(object) Adds the new {@link Ext.Toolbar} instance into this container @private
updateIconCls(object, object) @private
updateMsg(object) @private
updatePromptConfig(object, object) @private
updateTitle(object) Adds the new {@link Ext.Toolbar} instance into this container @private

Properties

Name Description
extend Utility class for generating different styles of message boxes. The framework provides a global singleton {@link Ext.Msg} for common usage. * Note that the MessageBox is asynchronous. Unlike a regular JavaScript `alert` (which will halt browser execution), showing a MessageBox will not cause the code to stop. For this reason, if you have code that should only run _after_ some user feedback from the MessageBox, you must use a callback function (see the `fn` configuration option parameter for the {@link #show show} method for more details). * # Example usage: * Basic alert: * @example preview Ext.Msg.alert('Title', 'The quick brown fox jumped over the lazy dog.', Ext.emptyFn); * Prompt for user data and process the result using a callback: * @example preview Ext.Msg.prompt('Name', 'Please enter your name:', function(text) { // process text value and close... }); * Confirmation alert: * @example preview Ext.Msg.confirm("Confirmation", "Are you sure you want to do that?", Ext.emptyFn); *
© Copyright 2005-2011 SharpKit. All rights reserved.