Unable to set Focus()

13 posts, 0 answers
  1. Martin
    Martin avatar
    39 posts
    Member since:
    Sep 2008

    Posted 04 Mar 2013 Link to this post

    If I replace the RadAutoCompleteBox with a normal wpf textbox I can set focus in event OnLoaded with method myTextBox.Focus();
    her is the code with the RadAutoCompleteBox that is not working:

    <Window x:Class="Propertydesigner.Window1"
            xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
            xmlns:controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"
            Title="Window1" Height="300" Width="300" Loaded="Window1_OnLoaded" >
        <Grid>
            <telerik:RadBusyIndicator Grid.Row="1"  IsIndeterminate="True">
                <Grid HorizontalAlignment="Stretch" Margin="5">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
     
                    <StackPanel>
                        <TextBlock Text="Enter a document name" Margin="0 0 0 5"/>
                        <controls:RadAutoCompleteBox  x:Name="SearchForDocuments"
                             DisplayMemberPath ="Name"
                             SelectionMode="Single"
                             TextSearchMode="Contains"                   
                             HorizontalAlignment="Stretch"
                             Margin="0 0 0 3"/>
                    </StackPanel>
     
                    <StackPanel Grid.Row="2"
                        Orientation="Horizontal"
                        HorizontalAlignment="Right"
                        VerticalAlignment="Center"
                        Margin="0 10 0 0">
                        <telerik:RadButton Content="OK"  Width="70" Margin="0 0 10 0" />
                        <telerik:RadButton Content="Cancel" Width="70"/>
                    </StackPanel>
                </Grid>
            </telerik:RadBusyIndicator>
        </Grid>
    </Window>


      private void Window1_OnLoaded(object sender, RoutedEventArgs e)
            {
                SearchForDocuments.Focus();
            }


  2. Ivo
    Admin
    Ivo avatar
    390 posts

    Posted 04 Mar 2013 Link to this post

    Hi Martin,

    Thank you for pointing this out.

    Actually this issue is known and a fix for it should be included into the next internal build.

    Regards,
    Ivo
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Subash
    Subash avatar
    15 posts
    Member since:
    Dec 2012

    Posted 14 Mar 2013 Link to this post

    Hi,

    What is the possible time to release the build which address these issue. This is very urgent for us to close one of our UAT fix.

    thanks
    Pons
  5. Ivo
    Admin
    Ivo avatar
    390 posts

    Posted 15 Mar 2013 Link to this post

    Hello Subash,

    This issue is scheduled for our next official release - Q1 2013 SP1. It will be released at the beginning of next month. Also when an internal build including this one is released I will write in this thread.

    I hope this one is suitable for you.

    Regards,
    Ivo
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Subash
    Subash avatar
    15 posts
    Member since:
    Dec 2012

    Posted 12 Apr 2013 Link to this post

    Hi 

    Is the  Q1 2013 SP1 got released? If yes Please let us know the link to  download the same.

    We are highly dependent on this build due to the customer escalation on focus issue.

    thanks
    Subbash 
  7. Ivo
    Admin
    Ivo avatar
    390 posts

    Posted 17 Apr 2013 Link to this post

    Hi Subash,

    I can confirm that a fix for the mentioned issue is included into the 2013 Q1 SP1. You can download the latest official version of RadControls for WPF here.

    All the best,
    Ivo
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  8. Navya
    Navya avatar
    1 posts
    Member since:
    Dec 2013

    Posted 12 Dec 2013 Link to this post

    2013.2.611.40  is the version that i use .  I cannot set focus on the RadWatermarkTextBox.
  9. Kalin
    Admin
    Kalin avatar
    1208 posts

    Posted 16 Dec 2013 Link to this post

    Hello Navya,

    I tested the scenario with the mentioned version of the controls and was able to successfully focus the AutoCompleteBox in the Loaded event of the Window.

    Could you please give us some more details on your set up and if you are able to share some code that would be really helpful?

    Regards,
    Kalin
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  10. Trevor
    Trevor avatar
    5 posts
    Member since:
    Aug 2014

    Posted 10 Sep 2014 in reply to Ivo Link to this post

    This still seems to be a bug. Setting focus to a RADAutocomplete box. seems to work when the box is empty, but not when It has data in it.

    Code snippet
    c#

    protected void originPort_TextChanged(object sender, AutoCompleteTextEventArgs e)
    {
    if (originPort.Text != "")
    {
    Session["ORGCNT"] = originPort.Entries[0].Value.Substring(0, 2);
    sendingDataSource.Select(DataSourceSelectArguments.Empty);
    sendAgent.DataBind();


    destinationPort.Focus();
    }
    }

    protected void destinationPort_TextChanged(object sender, AutoCompleteTextEventArgs e)
    {
    if (destinationPort.Text != "")
    {
    Session["DSTCNT"] = destinationPort.Entries[0].Value.Substring(0, 2);
    //receivingDataSource.Select(DataSourceSelectArguments.Empty);
    //receiveAgent.DataBind();
    }

    }

    --

    aspx

    <td class="bkBody">
    <telerik:RadAjaxPanel ID="RadAjaxPanel4" runat="server" Width="259px" Height="16px" >
    <table border="0" cellpadding="2" cellspacing="0" style="width: 100%">
    <tr>
    <th class="auto-style18">Place of Origin<br />
    <asp:CheckBox ID="cb_LoadDisch" runat="server" AutoPostBack="True" OnCheckedChanged="cb_LoadDisch_CheckedChanged" Text="Load/Disch" />
    </th>
    <td class="auto-style6">
    <telerik:RadAutoCompleteBox style="width:200px" ID="originPort" DefaultMessage="Select Origin....." runat="server" DataSourceID="portDataSource" DataTextField="pt_PortName" DataValueField="pt_Code" Width="300" DropDownWidth="300" InputType="Text" Skin="Metro" TextSettings-SelectionMode="Single" OnTextChanged="originPort_TextChanged" TabIndex="66" ShowLoadingIcon="False"> </telerik:RadAutoCompleteBox>
    <asp:SqlDataSource ID="portDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:NGENAConnectionString %>"
    SelectCommand="SELECT [pt_Code], (LTRIM(RTRIM([pt_PortName])) + ', ' + LTRIM(RTRIM([pt_CountryName])) + ' (' + pt_code + ')') AS pt_PortName FROM [Ports] WHERE [pt_IataCode] <> ''"></asp:SqlDataSource>
    <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" Text="!" ErrorMessage="Origin required." ForeColor="Red" ControlToValidate="originPort" Enabled="true" Font-Bold="true" ></asp:RequiredFieldValidator>
    </td>

    <th class="auto-style5">Place of Destination</th>
    <td class="auto-style6">
    <telerik:RadAutoCompleteBox style="width:200px" ID="destinationPort" DefaultMessage="Select Destination.." runat="server" DataSourceID="portDataSource" DataTextField="pt_PortName" DataValueField="pt_Code" Width="300" DropDownWidth="300" InputType="Text" Skin="Metro" TextSettings-SelectionMode="Single" TabIndex="67" ShowLoadingIcon="False" MinFilterLength="2" OnTextChanged="destinationPort_TextChanged" ></telerik:RadAutoCompleteBox>
    <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" Text="!" ErrorMessage="Destination required." ForeColor="Red" ControlToValidate="destinationPort" Enabled="true" Font-Bold="true"></asp:RequiredFieldValidator>--%>

    </td>
    </tr>
    <tr>


  11. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 15 Sep 2014 Link to this post

    Hello Trevor,

    We have performed some local tests and it seems that the behavior is correct at our end. Here is a video, demonstrating the local tests. Could you specify which version of our controls that you currently using and the browser under which you are experiencing the issue?


    Regards,
    Nencho
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  12. Trevor
    Trevor avatar
    5 posts
    Member since:
    Aug 2014

    Posted 17 Sep 2014 in reply to Nencho Link to this post

    HI

    Unfortunately  your video does not play. Just a white screen.

    using IE11, and Chrome.

    telerik ctls ver  2014.2.724.40

    I can only click in the box, by putting the cursor just at the end of the existing item..but I need to just click ON the item in the box of course. Clicking on the item should highlight, the item, like it does when I click past it, then backspace.

    I thought may be I could add an onclientclicking event.. but that's not valid on this control

    Help


     
  13. Trevor
    Trevor avatar
    5 posts
    Member since:
    Aug 2014

    Posted 17 Sep 2014 in reply to Nencho Link to this post

    I did event get your video to work, and I see that you are just doing what is FIDDLY for the user.. ie putting the cursor right at the end of the existing input area.

    If it were internal users using the system, maybe I could live with it, but it will be our customers trying to enter information.. and its just too fiddly. if you try and click at the end,, then hit backspace, and get it wrong.. the browser gores back a whole page, potentially losing all the input that has been done on the page. We need to be able to do what is intuitive.. click on the existing entry ANYWHRE in the box so as to select the existing item.

    Rgds
    Trevor Gall
    IT Director Asia Pacific
    (special project development consultant assigned to  Sweden)
  14. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 19 Sep 2014 Link to this post

    Hello Trevor,

    As I can see you had submitted a supported ticket, describing the requested functionality, which we have already replied. This is why, I would like to ask you to continue the correspondence in the other thread, in order to avoid duplication.

    Regards,
    Nencho
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WPF is Visual Studio 2017 Ready