[CLOSED] SetFocus issue on Firefox

  1. #1

    [CLOSED] SetFocus issue on Firefox

    I use "textField.Focus(true);" to set focus when the user opens the screens in my website. The problem is that in firefox sometimes the control seems to get the focus and then loses it very quickly. In IE it works perfectly. It's hard to send an example because the error is intermitent, just asking to know if you've heard of something similar and have any solution in mind.
    Last edited by Daniil; May 17, 2011 at 2:04 PM. Reason: [CLOSED]
  2. #2
    Hi,

    It seems another widget intercepts focus, try to add delay
    field.Focus(true, 500);
  3. #3
    Thanks, but didn't work. Tried 500, 1000 and 5000. Any other idea?
  4. #4
    Strange, now making some tests i'm seeing that in IE even if i don't call focus() the focus goes to the first control of the window (the control is in a window).
    If i call it in any control other than the first it sets the focus there for a moment and very quickly changes to the first control. In Firefox nobody never gets the focus, only using the mouse.
  5. #5
    Hi,

    Window get the focus on show. Therefore if the field inside the window then try to set focus for the field in the Show listener of the window (small delay can be required)
  6. #6
    Thanks, that's exactly this. If there aren't windows on the screen the focus works fine. Is there any workaround for this window behaviour or the only solution is to use the listener?
  7. #7
    Is there any workaround for this window behaviour or the only solution is to use the listener?
    I guess it's a single way. Are you in trouble to implement?
  8. #8
    Hi Daniil,

    Kind of... The problem is that we don't call "setfocus()" manually in each screen. We use an internal framework in which the developer only defines which control will receive the focus (we use annotations in the top of the .cs class associated with the screen, like [Focus("myControl")]. Behind the curtains, the control is retrieved and the setfocus in called upon it. If this is the only solution, we would have to, in each screen that uses window, manually alter it to use the listener.
  9. #9
    Could you clarify how it's implemented in this Framework?

    Thanks, but didn't work. Tried 500, 1000 and 5000. Any other idea?
    Please clarify how did you try? Here is my test case.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Show(object sender, DirectEventArgs e)
        {
            this.Window1.Show();
            this.TextField1.Focus(true, 100);
        }
    </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>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:Window ID="Window1" runat="server" Hidden="true" >
            <Items>
               <ext:TextField ID="TextField1" runat="server" />
               <ext:TextField runat="server" />
            </Items>
        </ext:Window>
        <ext:Button runat="server" Text="Show the window with calling .Focus()" OnDirectClick="Show" />
        </form>
    </body>
    </html>
    Also the is the AutoFocus feature in Ext.Net. Not sure that you can use it, but I will demonstrate.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Show(object sender, DirectEventArgs e)
        {
            this.Window1.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>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:Window ID="Window1" runat="server" Hidden="true">
            <Items>
                <ext:TextField 
                    runat="server" 
                    Text="Hello!" 
                    AutoFocus="true" 
                    AutoFocusDelay="100"
                    SelectOnFocus="true" />
                <ext:TextField runat="server" />
            </Items>
        </ext:Window>
        <ext:Button runat="server" Text="Show the window with AutoFocus" OnDirectClick="Show" />
        </form>
    </body>
    </html>

Similar Threads

  1. GridPanel to EditMode and SetFocus First Cell
    By jonasscalar in forum 1.x Help
    Replies: 8
    Last Post: Mar 27, 2012, 12:12 PM
  2. [CLOSED] Compatibility with chrome and firefox issue
    By imaa in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Dec 20, 2011, 10:42 PM
  3. Viewport layout issue in Firefox
    By venu in forum 1.x Help
    Replies: 2
    Last Post: Nov 08, 2011, 10:12 AM
  4. [CLOSED] [1.0] RowEditor layout issue in Firefox
    By methode in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 13, 2010, 11:51 AM
  5. [CLOSED] Firefox combo css issue
    By Ningdev in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 19, 2009, 10:34 PM

Posting Permissions