DataForm Focus issue

6 posts, 0 answers
  1. Bruno Samardzic
    Bruno Samardzic avatar
    3 posts
    Member since:
    Mar 2010

    Posted 07 Jul 2011 Link to this post

    Hello

    I'm wondering, i have this issue with focus change. 
    If i click anywhere inside the DataForm outside the input fields, focus goes to the first input field. It's pretty annoying if you try to hit some textbox, you miss it and then it ends up on a first field containg a dropdown, and then you accidentally change your dropdown selection:). Why is that happening and how to prevent it.

    Thanks!
  2. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 13 Jul 2011 Link to this post

    Hi Bruno Samardzic,

    Thanks for reporting this issue. Although not a bug , still I agree this is an UX disadvantage and we definitely need to fix it . I am scheduling this for improvement.
    One more time - thanks for the productive feedback ! I am updating your Telerik points.

    I am afraid I can not offer a good workaround . A possible hack would be to set a null background for the elements in the form ( by editing the default template) , so that the "white" area becomes no hit testable.

    Best wishes,
    Pavel Pavlov
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. DevCraft banner
  4. Edward
    Edward avatar
    45 posts
    Member since:
    Aug 2005

    Posted 25 Oct 2012 Link to this post

    Hi

    I have the same problem, is there a workaround for this issue? 

    I create a multi line textbox with height 80 in the AutoGeneratingField event. If I click on the white area (second to forth row) the focus goes to the first field of the data form.

    Thanks
    Edward


  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 29 Oct 2012 Link to this post

    Hi Edward,

    We investigated the case and basically, we cannot change the behavior without introducing breaking changes (which is something we are definitely not fans of). Did you try the workaround suggested above ? Doesn't it meet your requirements  ? 

    All the best,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Edward
    Edward avatar
    45 posts
    Member since:
    Aug 2005

    Posted 31 Oct 2012 Link to this post

    Hi

    I have a solution:

    For more clarity, The memo field has a height of 80 (good for 4 lines). 

    Problem: If I click in the dataform on an empty memo on the second, third or fourth line the focus goes a way to the first control. If I click on the first line. The focus stays on the memo.

    The proposed solution: ( is something probably not work with dynamic generated controls?)
    A possible hack would be to set a null background for the elements in the form ( by editing the default template) , so that the "white" area becomes no hit testable. 


    This is the code I use:

    private void RadDataForm1AutoGeneratingField(object pSender, AutoGeneratingFieldEventArgs pE)
    {
             
            if (pE.PropertyName.ToLower() == "notes")
            {
                 var ucControl = new UcMultiLine(_currentVisitorPoco.Notes);
                 ucControl.OnTextChanged += pText => _currentVisitorPoco.Notes = pText;
                 pE.DataField.Content = ucControl;
                
            }

    The memo field:

    <TextBox Name="PART_tbMemocontrol" TextAlignment="Left" TextWrapping="Wrap"  Height="80" VerticalAlignment="Top"  VerticalContentAlignment="Top"  AcceptsReturn="True" HorizontalAlignment="Stretch"  VerticalScrollBarVisibility="Visible" TextChanged="TbMemocontrolTextChanged" />

    The actual problem is that the MouseLeftButtonDown event bubbles down. The solution is to cancel this bubbling:

    private void RadDataForm1AutoGeneratingField(object pSender, AutoGeneratingFieldEventArgs pE)
    {
     
                
            if (pE.PropertyName.ToLower() == "notes")
            {
                var ucControl = new UcMultiLine(_currentVisitorPoco.Notes);
                ucControl.OnTextChanged += pText => _currentVisitorPoco.Notes = pText;
                pE.DataField.Content = ucControl;
            }
     
    ... more dynamic generation here
     
     
              pE.DataField.MouseLeftButtonDown += (p, pArgs) => pArgs.Handled = true;
     
    }


    I hope it will help someone :)

    Gr. Edward
  7. Avi
    Avi avatar
    1 posts
    Member since:
    Nov 2012

    Posted 07 Nov 2012 Link to this post

    Thanks for sharing of the issues
Back to Top
DevCraft banner