2009年06月06日 Saturday , 509 次点击

Chapter 9: Windows and Dialogs

Opening a dialog

Dialogs

Off the shelf

JAVASCRIPT:
  1. Ext.Msg.alert('Hey!', 'Something happened.');
  2.  
  3.  
  4.  
  5. Ext.Msg.prompt('Hey!', 'Tell me something', function(btn, text){
  6.  
  7.     if(btn == 'ok'){
  8.  
  9.         var data = text;
  10.  
  11.     }
  12.  
  13. }, this, false, '');

Confirmation

JAVASCRIPT:
  1. Ext.Msg.confirm('Hey!', 'Is this ok ?', function(btn, text){
  2.  
  3.     if(btn == 'yes'){
  4.  
  5.         //do some stuff
  6.  
  7.     }else{
  8.  
  9.         //do some stuff
  10.  
  11.     }
  12.  
  13. });

It's all progressing nicely

JAVASCRIPT:
  1. Ext.Msg.progress('Hey!', 'We\'re waiting ...', 'progressing');
  2.  
  3.  
  4.  
  5. var count = 0;
  6.  
  7.  
  8.  
  9. var interval = window.setInterval(function(){
  10.  
  11.     count = count + 0.04;
  12.  
  13.     Ext.Msg.updateProgress(count);
  14.  
  15.     if(count>= 1){
  16.  
  17.         window.clearInterval(interval);
  18.  
  19.         Ext.Msg.hide();
  20.  
  21.     }
  22.  
  23. }, 100);

Roll your own

We can use Ext.Msg.show() to create a custom dialog, which takes a config object to descide its manner.

Behavior

Windows

Starting examples

JAVASCRIPT:
  1. var w = new Ext.Window({
  2.  
  3.     height:100,
  4.  
  5.     width:200,
  6.  
  7.     title:'A Window',
  8.  
  9.     html:'<h1>Oh</h1><p>HI THERE EVERYONE</p>'
  10.  
  11. });
  12.  
  13. w.show();

Paneling potential

Layout

Configuration

When I'm cleaning windows
The extras
Desktopping
Further options

The collapse option lets a window act like one in the Linux desktop.

Framing our window

Manipulating

Events

State handling

JAVASCRIPT:
  1. var w = new Ext.Window({
  2.  
  3.     stateful = true,
  4.  
  5.     stateevents:['resize']
  6.  
  7. });

Window management

Default window manager behavior

When your create an Ext.Window, it will automatically be assigned to a default Ext.WindowGroup which, by default, can always be refered to via the Ext.WindowMgr class.

You can create more WindowGroups and assign your windows to them via the manager option.

It's the same with Ext.Window.toFront , but safer.

Multiple window example

Customer service WindowGroups

Summary

Tags :

随机日志

來留言吧!


Please copy the string 95LQye to the field below:

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

尚未有留言

尚未有留言

留言板RSS 引用 URI

來留言吧!

«
»