ExtJS 4“总是在顶部”窗口 [英] ExtJS 4 "always on top" Window
本文介绍了ExtJS 4“总是在顶部”窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要实现可以永远在上面的Window。我该怎么办?所有我使用WindowManager的尝试都给我没有结果:(
I need to implement Window which can be always on top. How can I to do it? All my tries with WindowManager give me no results :(
推荐答案
在Ext.window.Window中,有一个名为' > modal ':将其设置为true
In Ext.window.Window, there's a property called 'modal': set it to true.
否则,使用 WindowManager 来管理您的窗口:在这种情况下,您有按照以下步骤:
Otherwise, use the WindowManager to manage your windows: in this case you have to follow the following steps:
- 注册您的窗口到WindowManager( Ext.WindowManager.register (winId))
- 使用 bringToFront 方法将窗口设置在顶部( Ext.WindowManager.bringToFront(winId))
- 最后,使用 getActive 方法( Ext.WindowManager.getActive())
- register your windows to the WindowManager (Ext.WindowManager.register (winId))
- use bringToFront method to set your window on top (Ext.WindowManager.bringToFront (winId))
- finally, check the element on top with the getActive method (Ext.WindowManager.getActive ())
例如:
Ext.create ('Ext.window.Window', {
title: 'Your window' ,
width: 300 ,
height: 300 ,
html: 'ciao ciao' ,
modal: true
}).show ();
或者:
var win1 = Ext.create ('Ext.window.Window', {
title: 'Your window' ,
id: 'firstWin' ,
width: 300 ,
height: 300 ,
html: 'ciao ciao' ,
});
win1.showAt (50, 50);
var win2 = Ext.create ('Ext.window.Window', {
title: 'Your window' ,
id: 'secondWin' ,
width: 300 ,
height: 300 ,
html: 'I love pizza' ,
});
win2.showAt (60, 60);
// Register your floating objects (window in this case) to the WindowManager
Ext.WindowManager.register (win1);
Ext.WindowManager.register (win2);
// Bring 'firstWin' on top
Ext.WindowManager.bringToFront ('firstWin');
// Then, check the zIndexStack
alert (Ext.WindowManager.getActive().getId ()); // this is firstWin, the window with the highest zIndex
希望这可以帮助您。
Cyaz
这篇关于ExtJS 4“总是在顶部”窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文