[CLOSED] KeyMap inside Panel not working

  1. #1

    [CLOSED] KeyMap inside Panel not working

    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">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
       <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:Viewport ID="Viewport1" runat="server" Layout="VBoxLayout">
            <LayoutConfig>
                <ext:VBoxLayoutConfig Align="Stretch" />
            </LayoutConfig>
            <Items>
                <ext:Panel ID="Panel1" runat="server" Title="Panel1" Flex="1" Height="300">
                    <KeyMap>
                        <ext:KeyBinding Alt="true" StopEvent="true">
                            <Keys>
                                <ext:Key Code="W" />
                            </Keys>
                            <Listeners>
                                <Event Handler="Ext.Msg.alert('Hello','Hello');" />
                            </Listeners>
                        </ext:KeyBinding>
                    </KeyMap>
                </ext:Panel>
            </Items>
        </ext:Viewport>
        </form>
    </body>
    </html>
    Last edited by Daniil; Apr 06, 2012 at 10:59 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Please see #89:
    http://examples2.ext.net/#/Getting_S...nts/CHANGELOG/

    For now I can suggest to try the following.

    Example
    <ext:KeyMap runat="server" Target="#{Panel1}.getEl()">
        <ext:KeyBinding Alt="true">
            <Keys>
                <ext:Key Code="W" />
            </Keys>
            <Listeners>
                <Event Handler="Ext.Msg.alert('Hello','Hello');" />
            </Listeners>
        </ext:KeyBinding>
    </ext:KeyMap>
    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:
    http://examples2.ext.net/#/Keys/KeyM...egions_Toggle/
  3. #3
    I will try to create a external KeyMap as you suggest and set the Target property. Thanks

Similar Threads

  1. Replies: 2
    Last Post: Apr 02, 2012, 2:52 PM
  2. Replies: 2
    Last Post: Sep 21, 2010, 12:14 PM
  3. [CLOSED] Tooltip and KeyMap is not working on htmlEditor
    By yobnet in forum 1.x Premium Help
    Replies: 2
    Last Post: May 25, 2010, 9:20 AM
  4. [CLOSED] KeyMap in Panel not working in mozilla
    By klavsm in forum 1.x Premium Help
    Replies: 3
    Last Post: Feb 17, 2010, 11:19 AM
  5. KeyMap not working for whole window
    By dbassett74 in forum 1.x Help
    Replies: 3
    Last Post: May 21, 2009, 2:55 PM

Posting Permissions