[CLOSED] KeyMap Problem

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] KeyMap Problem

    I have implemented one keyNav
    below i s my code

    <ext:KeyNav ID="KeyNav1" runat="server" Target="={document.body}">
            <Left  Handler="lnkPrevious.fireEvent('click')" />
            <Right Handler="lnkNext.fireEvent('click')" />
            
        </ext:KeyNav>
    
    <ext:Button ID="lnkPrevious" runat="server" Icon="ResultsetPrevious" ToolTip="Previous Document">
                                   
                                    <DirectEvents>
                                       <Click  OnEvent="lnkPrevious_Click">
                                          
                                        </Click>
                                    </DirectEvents>
                                    
                                </ext:Button>
    
    <ext:Button ID="lnkNext" runat="server" Icon="ResultsetNext" ToolTip="next Document">
                                   
                                    <DirectEvents>
                                       <Click  OnEvent="lnkNext_Click">
                                          
                                        </Click>
                                    </DirectEvents>
                                    
                                </ext:Button>
    the above code fires the direct event of the particular button
    Now the problem is that to use the above KeyNav, every time i have to click anywhere on the page,then only it gets activated or else it does not,
    if after the page loads and then i press left key it does not fires..i have to click on the page anywhere after that it fires,and again after the direct event gets fires i have to again click on the page to reuse it again

    Thanks
    Last edited by Daniil; Mar 07, 2012 at 8:29 PM. Reason: [CLOSED]
  2. #2
    Hi,

    I guess you test with IE. At least, I was able to reproduce the problem under IE only.

    To fix I can suggest to use a Viewport control, it causes a page body to be expanded to whole page space.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void TestHandler(object sender, DirectEventArgs e)
        {
            X.Msg.Alert("", "Hello!").Show();
        }
    </script>
    
    <!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>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        <ext:KeyNav runat="server" Target="={document.body}">
            <Left Handler="Button1.fireEvent('click')" />
            <Right Handler="Button2.fireEvent('click')" />
        </ext:KeyNav>
        <ext:Viewport runat="server">
            <Items>
                <ext:Button 
                    ID="Button1" 
                    runat="server" 
                    Text="Left" 
                    OnDirectClick="TestHandler" />
                <ext:Button 
                    ID="Button2" 
                    runat="server" 
                    Text="Right" 
                    OnDirectClick="TestHandler" />
            </Items>
        </ext:Viewport>
    </body>
    </html>
  3. #3
    Thanx for Reply
    I have check your example in IE
    i have check above code given by you

    but now if i run this code, when first i tried to press left key then its work and whole page refresh
    so now i directly next time press left key again then its not work, but if i click on anywhere in page in browser by mouse and
    then after again press left key then its work

    so my attention to tell you is then its work, but every time after key press i need to click on page by mouse then after it work again
  4. #4
    I was unable to reproduce.

    Please clarify:

    1. What browser do you test with?

    2. What are the exact steps?
  5. #5
    I am using IE 7
    but let me check, then i will send you detailed steps
  6. #6
    I was unable to reproduce with IE7 as well.

    So, waiting the steps or any more details.
  7. #7
    I tried your above solution n it worked in all the browsers
    But still i was facing the problem
    So i tried to figure out the problem,the problem was that i am using a third party control which is an java applet placed inside the content of the panel,Now when i press the right or left key the page loads corectly but the applet takes the focus,so every time i have to click on the page to navigate,then i tried to solve the problem of applet taking the focus by forcefully giving focus to the body with placing documnet.body.focus() in the direct event of the button on complete="documnet.body.focus"
    This works very perfectly in IE..now i dnt have to click anywhere on the page to navigate..bcoz i have forcefully given the fucus to the body..But now the problem is.this works fine in IE but not in Firefox and chrome
  8. #8
    Quote Originally Posted by legaldiscovery View Post
    I tried your above solution n it worked in all the browsers
    But still i was facing the problem
    So i tried to figure out the problem,the problem was that i am using a third party control which is an java applet placed inside the content of the panel,Now when i press the right or left key the page loads corectly but the applet takes the focus,so every time i have to click on the page to navigate,then i tried to solve the problem of applet taking the focus by forcefully giving focus to the body with placing documnet.body.focus() in the direct event of the button on complete="documnet.body.focus"
    This works very perfectly in IE..now i dnt have to click anywhere on the page to navigate..bcoz i have forcefully given the fucus to the body..But now the problem is.this works fine in IE but not in Firefox and chrome
    Using ExtJS, you can test if the browser isIE and run different scripts if true|false. Or, even run different scripts for different versions of IE.

    Example

    Ext.isIE()
    http://docs.sencha.com/ext-js/3-4/#!/api/Ext
    Geoffrey McGill
    Founder
  9. #9
    yes i know the use of Ext.isIE.

    But my problem is not concerned with this..
    My problem is totally different..
    Can u again go through all my last post
    Inshort i am using third party control which is an java applet on same page where i use Ext.net controls.so after the page loads the applet takes the focus so in return i cant acess the navigation key..to access it i have make a mouse click anywhere on the page..Then to solve this problem
    i tried adding documnet.body.focus() on the complete of direct event conplete="document.body.focus()".
    This works perfectly in IE but not in FOrefox and chrome
  10. #10
    Please try:
    Complete="Ext.getBody().focus(100);"
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] KeyMap and Opera problem
    By voipswitch in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 08, 2013, 9:18 AM
  2. KeyMap and Razor engine problem...
    By ndfra in forum 2.x Help
    Replies: 1
    Last Post: Jun 04, 2012, 4:14 PM
  3. [CLOSED] KeyMap and IE
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jan 06, 2011, 2:48 PM
  4. [CLOSED] Keymap key code
    By ogokgol in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 23, 2010, 7:40 AM
  5. [CLOSED] Inherit KeyMap
    By Jurke in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 15, 2009, 10:59 AM

Posting Permissions