PDA

View Full Version : Get if a window is modal



Fire-Dragon-DoL
16 Jan 2012, 10:43 AM
Outside the window class, (or even inside an event of that window) I would like to see if it's modal

I know it's a config but I need it to disable the taskbar when my window becomes active if it's modal :\ (it's a desktop-like app)

mitchellsimoens
16 Jan 2012, 11:07 AM
Like this?


var win = new Ext.window.Window({
width : 400,
height : 400,
title : 'Test',
html : 'test',
modal : true
});

win.show();

console.log(win.modal);

Fire-Dragon-DoL
16 Jan 2012, 12:38 PM
Mhh, I set modal in my window class (Ext.define), however when I write myinstance.modal it returns 'undefined', not true nor false (I set it to true).

Note that I'm checking it not in the scope of the class, I'm from a controller which is getting a ref to that view and then check the modal value.

I found I can access "modal" only in the constructor of the window

dedoz
16 Jan 2012, 8:48 PM
Prolly the problem is on the line of code where u are getting the reference to the view.

You can do console.log(myInstance) and check on firebug console or similar the whole structure of your object. Check there if others confings of you view are set. if none of them are there, then u have a problem on getting the reference to the view class.

(sorry for my bad english)

Fire-Dragon-DoL
16 Jan 2012, 8:51 PM
No problem, I found the solution: in the constructor the config is applied after callParent, so in constructor is a bit problematic effectively find out the modal value.

I solved by moving code to initComponent, there I can access it simply with "this.modal" and do some stuff