PDA

View Full Version : bogus & desktop



Poma_007
24 Nov 2010, 3:02 AM
Hello all, i've got problem occured when i'm trying to activate window from a shortcut on a desktop
_ttp://dev.sencha.com/deploy/dev/examples/desktop/desktop.html

example screen
http://pipicek.net/thumbs/e8ac61f54ffe5171ce5fd4b34a2ef324.jpg (http://pipicek.net/images/e8ac61f54ffe5171ce5fd4b34a2ef324.jpg)


MyDesktop.BogusModule = Ext.extend(Ext.app.Module, {
init : function(){
this.launcher = {
text: 'Window '+(++windowIndex),
iconCls:'bogus',
handler : this.createWindow,
scope: this,
windowId:windowIndex
}
},

createWindow : 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 : '<p>Something useful would be in here.</p>',
iconCls: 'bogus',
shim:false,
animCollapse:false,
constrainHeader:true
});
}
win.show();
}
});


MyDesktop.BogusMenuModule = Ext.extend(MyDesktop.BogusModule, {
init : function(){
this.launcher = {
text: 'Bogus Submenu',
iconCls: 'bogus',
handler: function() {
return false;
},
menu: {
items:[{
text: 'Bogus Window '+(++windowIndex),
iconCls:'bogus',
handler : this.createWindow,
scope: this,
windowId: windowIndex
},{
text: 'Bogus Window '+(++windowIndex),
iconCls:'bogus',
handler : this.createWindow,
scope: this,
windowId: windowIndex
},{
text: 'Bogus Window '+(++windowIndex),
iconCls:'bogus',
handler : this.createWindow,
scope: this,
windowId: windowIndex
},{
text: 'Bogus Window '+(++windowIndex),
iconCls:'bogus',
handler : this.createWindow,
scope: this,
windowId: windowIndex
},{
text: 'Bogus Window '+(++windowIndex),
iconCls:'bogus',
handler : this.createWindow,
scope: this,
windowId: windowIndex
}]
}
}
}
});
tried so:

MyDesktop.BogusModule = Ext.extend(Ext.app.Module, {
id : ++windowIndex,
init : function(){
this.launcher = {
text: 'Window '+windowIndex,
iconCls:'bogus',
handler : this.createWindow,
scope: this,
windowId:windowIndex
}
},

createWindow : 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 : '<p>Something useful would be in here.</p>',
iconCls: 'bogus',
shim:false,
animCollapse:false,
constrainHeader:true
});
}
win.show();
}
});

Desktop:
<dt id="1-shortcut">
<a href="# (http://www.sencha.com/forum/view-source:http://dev.sencha.com/deploy/dev/examples/desktop/desktop.html#)"><img src="images/s.gif (http://www.sencha.com/forum/view-source:http://dev.sencha.com/deploy/dev/examples/desktop/images/s.gif)" />
<div>bogus</div></a>
</dt>

tried so:

MyDesktop.BogusModule = Ext.extend(Ext.app.Module, {
appAlias : ++windowIndex,
init : function(){
this.launcher = {
text: 'Window '+windowIndex,
iconCls:'bogus',
handler : this.createWindow,
scope: this,
windowId:windowIndex
}
},

createWindow : 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 : '<p>Something useful would be in here.</p>',
iconCls: 'bogus',
shim:false,
animCollapse:false,
constrainHeader:true
});
}
win.show();
}
});

Desktop:
<dt id="1-shortcut">
<a href="# (http://www.sencha.com/forum/view-source:http://dev.sencha.com/deploy/dev/examples/desktop/desktop.html#)"><img src="images/s.gif (http://www.sencha.com/forum/view-source:http://dev.sencha.com/deploy/dev/examples/desktop/images/s.gif)" />
<div>bogus</div></a>
</dt>

but there is no reaction - > all mtehods are useless

Animal
24 Nov 2010, 4:45 AM
You have to configure your Module with a hardcoded id

Then add the shortcut to reference that:



<dt id="<Your Module ID>-shortcut">
<a href="#"><img src="images/s.gif" />
<div>Your module desc</div></a>
</dt>

Poma_007
24 Nov 2010, 5:19 AM
Now i've got a new problem:

(firebug)
src is undefined
[Break on this error] var win = desktop.getWindow('bogus'+src.windowId);

Animal
24 Nov 2010, 7:38 AM
You have a bug in your code? Fix it.

Poma_007
24 Nov 2010, 8:50 AM
Fix it.
var windowIndex = 0;

MyDesktop.BogusModule = Ext.extend(Ext.app.Module, {
id:windowIndex,
init : function(){
this.launcher = {

text: '??????: '+(++windowIndex),
iconCls:'server',
handler : this.createWindow,
scope: this,
windowId:windowIndex
}
},

createWindow : function(src){
var desktop = this.app.getDesktop();
var win = desktop.getWindow(src.windowId);

// tabs for the center
var tabs = new Ext.TabPanel({
iconCls: 'server',
region: 'center',
margins:'3 3 3 0',
activeTab: 0,
defaults:{autoScroll:true},

items:[{
title: '?????????? ???????? '+src.windowId,
html: 'tra lala'
},{
title: 'FAQ',
html: 'tra lala'
}]
});

var nav = new Ext.Panel({
title: '?????????',
region: 'west',
split: true,
width: 200,
collapsible: true,
iconCls: 'tehno',
margins:'3 0 3 3',
cmargins:'3 3 3 3',
items:[{ html: '<div class="dud_menu" onclick="showContent2('+src.windowId+',\'/includes/ra.php?server='+src.windowId+'&go=1\');">??????????</div>' }]
}
);


if(!win){
win = desktop.createWindow({
id: src.windowId,
title:src.text,
width:800,
height:430,
iconCls: 'server',
shim:false,
animCollapse:false,
constrainHeader:true,

plain:true,
layout: 'border',

items: [nav, tabs]
});
}
win.show();
showContent2(src.windowId,'/includes/ra.php?server='+src.windowId+'&go=1');





}
});

MyDesktop.BogusMenuModule = Ext.extend(MyDesktop.BogusModule, {

init : function(){


this.launcher = {
text: '<b>??? ???????</b>',
iconCls: 'server',
handler: function() {
return false;
}, menu: {
items:[ {
text: '?????? 227032',
iconCls: 'server',
handler : this.createWindow,
scope: this,
windowId: '227032'
}, {
text: '?????? 227030',
iconCls: 'server',
handler : this.createWindow,
scope: this,
windowId: '227030'
},] }

}
}
});
i dont know where is the trouble, seems all is correct

Animal
24 Nov 2010, 12:39 PM
src undefined? Break there and see who passed it in and where they got it from.