-
FEATURED COMPONENTS
First time here? Check out the FAQ!
1 | initial version | |
I would like to face the pressure of a combination of keys (es: CTRL+M), open the BorderLayout (West) and give the focus to the first content control.
In my code i have:
mainLayout.addEventListener(Events.ON_CTRL_KEY, new EventListener<KeyEvent>() {
@Override
public void onEvent(KeyEvent event) throws Exception {
if (event.getKeyCode() == (byte)'M' && event.isCtrlKey())
layoutWest.setOpen(!layoutWest.isOpen());
event.stopPropagation();
}
});
i have also:
@Listen(Events.ON_OPEN+"=#layoutWest")
public void onOpenMenuLeft() {
if (layoutWest.isOpen())
treeMain.focus(); // first content control of the BorderLayout West component.
}
If i open the BorderLayout West using the mouse, everything works perfectly. If you instead use the layoutwest.setopen(True) from the code, the onopen event of component LayoutWest, is not raised.
What one can help me understand?
Thanks