View Full Version : [CLOSED] KeyMap inside Panel not working

Apr 02, 2012, 8:57 AM
I can't get a KeyMap inside a panel to work. Am I doing something wrong here or is this a beta feature :-)

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Bug1.aspx.cs" Inherits="PagingStoreTest.Bug1" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Viewport ID="Viewport1" runat="server" Layout="VBoxLayout">
<ext:VBoxLayoutConfig Align="Stretch" />
<ext:Panel ID="Panel1" runat="server" Title="Panel1" Flex="1" Height="300">
<ext:KeyBinding Alt="true" StopEvent="true">
<ext:Key Code="W" />
<Event Handler="Ext.Msg.alert('Hello','Hello');" />

Apr 02, 2012, 12:23 PM

Please see #89:

For now I can suggest to try the following.


<ext:KeyMap runat="server" Target="#{Panel1}.getEl()">
<ext:KeyBinding Alt="true">
<ext:Key Code="W" />
<Event Handler="Ext.Msg.alert('Hello','Hello');" />

But I think it won't work in all browsers, because the Panel getEl returns a "div" element which, by standard, doesn't listen key events.

It will work if, for example, there is a focused TextField in that Panel. Aslo it will work for GridPanel, because there is an anchor (<a>) HTML element to support cell/row focusing.

Generally, I would suggest to use KeyMap for elements which listen key events itself. For example:

Apr 02, 2012, 1:51 PM
I will try to create a external KeyMap as you suggest and set the Target property. Thanks