2 Ext.onReady(function(){
4 var handleAction = function(action){
5 Ext.example.msg('<b>Action</b>', 'You clicked "' + action + '"');
8 var colorMenu = Ext.create('Ext.menu.ColorPicker', {
9 handler: function(cm, color){
10 Ext.example.msg('Color Selected', '<span style="color:#' + color + ';">You choose {0}.</span>', color);
14 Ext.create('Ext.Window', {
19 bodyStyle: 'padding:10px',
22 tbar: Ext.create('Ext.toolbar.Toolbar', {
24 overflowHandler: 'Menu'
30 handler: Ext.Function.pass(handleAction, 'Menu Button'),
31 menu: [{text: 'Menu Item 1', handler: Ext.Function.pass(handleAction, 'Menu Item 1')}]
36 handler: Ext.Function.pass(handleAction, 'Cut'),
37 menu: [{text: 'Cut menu', handler: Ext.Function.pass(handleAction, 'Cut menu')}]
41 handler: Ext.Function.pass(handleAction, 'Copy')
45 menu: [{text: 'Paste menu', handler: Ext.Function.pass(handleAction, 'Paste menu')}]
49 handler: Ext.Function.pass(handleAction, 'Format')
53 handler: Ext.Function.pass(handleAction, 'Right')
55 text: 'Choose a Color',
56 menu: colorMenu // <-- submenu by reference