zoggo
7 Sep 2011, 5:37 AM
I created my own class:
Ext.define("AgisViewerLight.Modul.Template",{
MenuClickEvent : null,
ModulWindow: null,
MenuItem: null,
config: {
ModulID : "Template",
MenuPictureSource : "Pictures/om_logo_rot_viewer.png",
MenuPictureText : "TemplateModul",
Viewer : null,
Map : null
},
constructor: function(config) {
this.initConfig(config);
this.callParent();
this.ModulWindow = Ext.create('widget.window', {
height: 495,
width: 400,
layout: {
type: 'fit'
},
closeAction: 'hide',
collapsible: true,
title: 'My Window',
listeners: {
activate: function () {
this.removeCls("ModulWindow");
this.addCls("ModulWinodwActive");
},
deactivate: function () {
this.removeCls("ModulWinodwActive");
this.addCls("ModulWindow");
}
}
});
this.Viewer.ModulCollection.add(this);
return this;
},
show: function () {
this.ModulWindow.show();
return this;
},
enable: function(){
MenuClickEvent = dojo.connect(this.MenuItem, "onclick", this.show);
return this;
}
});
and I instantiate the Class like this
var pModulTest2 = Ext.create('AgisViewerLight.Modul.Template',{
Viewer: AGISViewerLight,
Map: AGISViewerLight.Map
});
pModulTest2.enable();
The enable-method binds the show-method to a clickevent from a html-image. Juts now all works like expectet. The troubles starts in when calling the show-method. from my click-event. The this-object is now the "click-object" (a image tag) a not my own class object. So I can't acces my ModulWindow object. I have to change the scope in some way.
Could anyone help me?
Ext.define("AgisViewerLight.Modul.Template",{
MenuClickEvent : null,
ModulWindow: null,
MenuItem: null,
config: {
ModulID : "Template",
MenuPictureSource : "Pictures/om_logo_rot_viewer.png",
MenuPictureText : "TemplateModul",
Viewer : null,
Map : null
},
constructor: function(config) {
this.initConfig(config);
this.callParent();
this.ModulWindow = Ext.create('widget.window', {
height: 495,
width: 400,
layout: {
type: 'fit'
},
closeAction: 'hide',
collapsible: true,
title: 'My Window',
listeners: {
activate: function () {
this.removeCls("ModulWindow");
this.addCls("ModulWinodwActive");
},
deactivate: function () {
this.removeCls("ModulWinodwActive");
this.addCls("ModulWindow");
}
}
});
this.Viewer.ModulCollection.add(this);
return this;
},
show: function () {
this.ModulWindow.show();
return this;
},
enable: function(){
MenuClickEvent = dojo.connect(this.MenuItem, "onclick", this.show);
return this;
}
});
and I instantiate the Class like this
var pModulTest2 = Ext.create('AgisViewerLight.Modul.Template',{
Viewer: AGISViewerLight,
Map: AGISViewerLight.Map
});
pModulTest2.enable();
The enable-method binds the show-method to a clickevent from a html-image. Juts now all works like expectet. The troubles starts in when calling the show-method. from my click-event. The this-object is now the "click-object" (a image tag) a not my own class object. So I can't acces my ModulWindow object. I have to change the scope in some way.
Could anyone help me?