View Full Version : Auto closing menus
Steffan
19 Sep 2007, 9:35 PM
Is there a way to make the menus in a toolbar close automatically either via a timer or when you mouse off the menu? As it is now, they stay open til you click something else.
evant
19 Sep 2007, 10:13 PM
http://extjs.com/forum/showthread.php?t=12974&highlight=menu+mouseout
Steffan
20 Sep 2007, 5:29 AM
According to that referenced thread they do not work entirely as desired. Did anyone ever come up with an ideal situation? I tried working with the mouseout option of the menu but I can't get it to fire at any time other than when the menus are initializing.
Can you post your code as the following - which updates a status bar - definitely works for me:
mnuFile.addListener('mouseover', OnMenuMouseOver);
mnuFile.addListener('mouseout', OnMenuMouseOut);
// ...
function OnMenuMouseOver(m, e, menuItemId){
var mnuItem = m.findTargetItem(e);
if (mnuItem){
var txt = mnuItem.tooltip ? mnuItem.tooltip : mnuItem.text;
getStatusBar().setContent(txt);
}
}
function OnMenuMouseOut(m, e, menuItemId){
getStatusBar().setContent(''); // Just replace this with m.hide(true);
}
Steffan
20 Sep 2007, 9:57 PM
Problem with this code is that as soon as you mouse off the toolbar onto the actual menu it closes. It should stay open until you either mouse off the menu button or mouse off the drop down itself. What's next?
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.