PDA

View Full Version : adding a toolbar menue



libertux
28 Oct 2007, 12:43 AM
Hi everybody ;)
i try to add a toolbar menue to an existing Desctop window but nothing gone!
my code :


createDesigner : function(src){
var desktop = this.app.getDesktop();
var win = desktop.getWindow('bogus'+src.windowId);

var menu = new Ext.menu.Menu({ //<-------------- My code
id: 'mainMenu', //<-------------- My code
items: [ //<-------------- My code
{ //<-------------- My code
text: 'I like Ext', //<-------------- My code
checked: true, //<-------------- My code

}, //<-------------- My code
{ //<-------------- My code
text: 'Ext for jQuery', //<-------------- My code
checked: true, //<-------------- My code
//checkHandler: onItemCheck //<-------------- My code
}
]
});


var tb = new Ext.Toolbar(); //<-------------- My code
tb.render('toolbar'); //<-------------- My code
tb.add({ //<-------------- My code
text:'Button w/ Menu', //<-------------- My code
iconCls: 'bmenu', //<-------------- My code
menu: menu //<-------------- My code
}); //<-------------- My code


if(!win){
win = desktop.createWindow({
id: 'bogus'+src.windowId,
title:src.text,
width:640,
height:480,
html : '<div id="toolbar"></div>',
iconCls: 'bogus',
shim:true,
animCollapse:true,
constrainHeader:true,
//item : tb
//items: //ajout des items composant
});
}



win.show();
},


please help :(

libertux
28 Oct 2007, 1:28 AM
I change my code to


createDesigner : function(src){
var desktop = this.app.getDesktop();
var win = desktop.getWindow('bogus'+src.windowId);

if(!win){
win = desktop.createWindow({
id: 'bogus'+src.windowId,
title:src.text,
width:640,
height:480,
// html : '<iframe id="sampleframe" name="sampleframe" width="100%" height="100%" frameborder="2" src="Modules/tt/ExtStart.html" style="border: 0px solid #cecece;"></iframe>',
iconCls: 'bogus',
shim:true,
animCollapse:true,
constrainHeader:true,
tbar:[{
tooltip:{title:'File Menue', text:'This is the File Menue!'},
text:'File'
},'-',{
tooltip:'Add a new user',
text:'Edit'
}]

});
}
win.show();
},


an i got the toolbar naw haw can i add a menue to this tool bar?
i try


tbar:[{
tooltip:{title:'File Menue', text:'This is the File Menue!'},
text:'File'
menu:....
},'-',{
tooltip:'Add a new user',
text:'Edit'
menu:....
}]


but it dont work
THKS