[FIXED] [1.0 RC] KeyMap StopEvent in IE

  1. #1

    [FIXED] [1.0 RC] KeyMap StopEvent in IE

    Hi!

    I have this piece of code inside my page to detect Ctrl+O shortcut, for example. It also happens with F5 shortcut.

    <ext:KeyMap runat="server" Target="={Ext.isGecko ? Ext.getDoc() : Ext.getBody()}">
        <ext:KeyBinding StopEvent="true" Ctrl="true">
            <Keys>
                <ext:Key Code="O" />
            </Keys>
            <Listeners>
                <Event Handler="Ext.Msg.alert('Sample');" />
            </Listeners>
        </ext:KeyBinding>
    </ext:KeyMap>
    I tested in the latest build of the most popular browsers: Firefox 3.6.13, Chrome 8.0.552.224 and IE 8.0.7600.16385.
    And only in IE8, the event pass to the browser and opens a window, or refresh if the key is F5.

    How can I solve it? Or what I have to do to fix it?
    Last edited by Daniil; Jun 27, 2011 at 10:35 AM. Reason: [FIXED]
  2. #2
    I've found these articles realted to them:


    And it seems that there aren't any solution about it.
  3. #3
    Hi,

    Below is a solution for Ctrl+O. This solution is a combination of:
    http://forums.ext.net/showthread.php...-for-Help-Page
    http://stackoverflow.com/questions/3...ernet-explorer

    Example
    <%@ Page Language="C#" %>
    
    <%@ 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>Ext.Net Example</title>
    
        <script type="text/javascript">
            var processKey = function(e) {
                if (Ext.isIE) {
                    // IE uses event instead of passed argument.
                    e = event;
                }
    
                if (e.ctrlKey && e.keyCode == 79) {
                    Ext.Msg.alert("Ctrl+O", "Hello from Ctrl+O");
                    if (!Ext.isIE) {
                        e.preventDefault();
                        return;
                    }
                    e.keyCode = 0;
                    return false;
                }
            }
    
            var doInit = function() {
                document.onkeydown = processKey;
            }
        </script>
    
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server">
            <Listeners>
                <DocumentReady Handler="doInit();" />
            </Listeners>
        </ext:ResourceManager>
        </form>
    </body>
    </html>
    I am pretty sure the similar thing will work with F5.
  4. #4
    Yes, it works the same with F5.

    Example
    <%@ Page Language="C#" %>
    
    <%@ 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>Ext.Net Example</title>
    
        <script type="text/javascript">
            var processKey = function(e) {
                if (Ext.isIE) {
                    // IE uses event instead of passed argument.
                    e = event;
                }
    
                if (e.ctrlKey && e.keyCode == 79) {
                    Ext.Msg.alert("Ctrl+O", "Hello from Ctrl+O");
                    if (!Ext.isIE) {
                        e.preventDefault();
                        return;
                    }
                    e.keyCode = 0;
                    return false;
                }
    
                if (e.keyCode == Ext.EventObject.F5) {
                    Ext.Msg.alert("F5", "Hello from F5");
                    if (!Ext.isIE) {
                        e.preventDefault();
                        return;
                    }
                    e.keyCode = 0;
                    return false;
                }
            }
    
            var doInit = function() {
                document.onkeydown = processKey;
            }
        </script>
    
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server">
            <Listeners>
                <DocumentReady Handler="doInit();" />
            </Listeners>
        </ext:ResourceManager>
        </form>
    </body>
    </html>
  5. #5
  6. #6
    The fix has been added into ExtJS sources.

    It will be available in Ext.Net when we will update our ExtJS sources. We are planning to make it for Ext.Net RC2.

Similar Threads

  1. [CLOSED] KeyMap Problem
    By legaldiscovery in forum 1.x Legacy Premium Help
    Replies: 13
    Last Post: Mar 01, 2012, 12:27 PM
  2. [CLOSED] KeyMap and IE
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jan 06, 2011, 2:48 PM
  3. [CLOSED] KeyBinding F5 and stopevent?
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: May 26, 2009, 7:11 PM
  4. KeyMap not working for whole window
    By dbassett74 in forum 1.x Help
    Replies: 3
    Last Post: May 21, 2009, 1:55 PM
  5. [CLOSED] Inherit KeyMap
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 15, 2009, 10:59 AM

Tags for this Thread

Posting Permissions