3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
16 'Ext.window.MessageBox',
20 Ext.onReady(function(){
21 Ext.get('mb1').on('click', function(e){
22 Ext.MessageBox.confirm('Confirm', 'Are you sure you want to do that?', showResult);
25 Ext.get('mb2').on('click', function(e){
26 Ext.MessageBox.prompt('Name', 'Please enter your name:', showResultText);
29 Ext.get('mb3').on('click', function(e){
32 msg: 'Please enter your address:',
34 buttons: Ext.MessageBox.OKCANCEL,
41 Ext.get('mb4').on('click', function(e){
43 title:'Save Changes?',
44 msg: 'You are closing a tab that has unsaved changes. <br />Would you like to save your changes?',
45 buttons: Ext.MessageBox.YESNOCANCEL,
48 icon: Ext.MessageBox.QUESTION
52 Ext.get('mb6').on('click', function(){
55 msg: 'Loading items...',
56 progressText: 'Initializing...',
63 // this hideous block creates the bogus progress
67 Ext.MessageBox.hide();
68 Ext.example.msg('Done', 'Your fake items were loaded!');
71 Ext.MessageBox.updateProgress(i, Math.round(100*i)+'% completed');
75 for(var i = 1; i < 13; i++){
76 setTimeout(f(i), i*500);
80 Ext.get('mb7').on('click', function(){
82 msg: 'Saving your data, please wait...',
83 progressText: 'Saving...',
86 waitConfig: {interval:200},
87 icon:'ext-mb-download', //custom class in msg-box.html
90 setTimeout(function(){
91 //This simulates a long-running operation like a database save or XHR call.
92 //In real code, this would be in a callback function.
93 Ext.MessageBox.hide();
94 Ext.example.msg('Done', 'Your fake data was saved!');
98 Ext.get('mb8').on('click', function(){
99 Ext.MessageBox.alert('Status', 'Changes saved successfully.', showResult);
102 //Add these values dynamically so they aren't hard-coded in the html
103 Ext.fly('info').dom.value = Ext.MessageBox.INFO;
104 Ext.fly('question').dom.value = Ext.MessageBox.QUESTION;
105 Ext.fly('warning').dom.value = Ext.MessageBox.WARNING;
106 Ext.fly('error').dom.value = Ext.MessageBox.ERROR;
108 Ext.get('mb9').on('click', function(){
109 Ext.MessageBox.show({
110 title: 'Icon Support',
111 msg: 'Here is a message with an icon!',
112 buttons: Ext.MessageBox.OK,
113 animateTarget: 'mb9',
115 icon: Ext.get('icons').dom.value
119 function showResult(btn){
120 Ext.example.msg('Button Click', 'You clicked the {0} button', btn);
123 function showResultText(btn, text){
124 Ext.example.msg('Button Click', 'You clicked the {0} button and entered the text "{1}".', btn, text);