Selected values don't hold alignment

15 posts, 1 answers
  1. Brian@WTG
    Brian@WTG avatar
    13 posts
    Member since:
    Mar 2011

    Posted 08 Mar 2011 Link to this post

    Hello,

    When a value of autocomplete of the dropdownlist box is wider than the control object, the text aligns to the right. The user can still type into the control, but the cursor is hidden to the left.

    I have looked for a simple text align left, and I found it deep in the UI elements, based on the "telerik.wincontrols.ui.radtextboxitem" part of this control. It's set to left.

    What am I missing here?

    Thank you
  2. Jason Parrish
    Jason Parrish avatar
    87 posts
    Member since:
    Sep 2009

    Posted 08 Mar 2011 Link to this post

    I experience the same issue.  

    I thought it might have just been my code and have it as a "TO LOOK INTO" task.  Glad to see it might not be my code.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Brian@WTG
    Brian@WTG avatar
    13 posts
    Member since:
    Mar 2011

    Posted 10 Mar 2011 Link to this post

    For now I just widened the control to cover 95% of the available values.
  5. Answer
    Peter
    Admin
    Peter avatar
    1148 posts

    Posted 11 Mar 2011 Link to this post

    Hello Brian,

    We are aware of this behavior. However, it cannot be worked around properly (the only suitable workaround is to make the DropDown wider) - it comes from the hosted Microsoft TextBox inside in RadDropDownList and you can observe the same behavior in the Microsoft ComboBox. For additional details, please refer to the attached project in my reply.

    Do not hesitate to contact us if you have other questions.
     
    Kind regards,
    Peter
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  6. Brian@WTG
    Brian@WTG avatar
    13 posts
    Member since:
    Mar 2011

    Posted 11 Mar 2011 Link to this post

    I currently have VS2008 so I can't open that project, but thank you.
  7. Aaron
    Aaron avatar
    1 posts
    Member since:
    Jul 2010

    Posted 10 Jun 2011 Link to this post

    I am not sure if this is the behavior you are looking for, but I hope this helps. When the listbox value change I capture the event, record the length, then go into a for loop the sends the left arrow as many spaces as are needed in the string. This way when each time a new value is selected, the beginning of my string is visible, and not the end, as is the case with string that are longer than than the control width.
    so I have:
    Private Sub RadListBox_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles  RadListBox.SelectedValueChanged
         
           If Me. RadListBox.SelectedIndex > 0 Then
               Dim cnt As Integer =  RadListBox.SelectedText.Length
               For i As Integer = 0 To cnt
                   System.Windows.Forms.SendKeys.Send("{LEFT}")
               Next
           End If
       
       End Sub
     i think you can also just do SendKeys.Send("{LEFT number}" and that will do it the specified number of times.

    I hope this helps.
  8. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 15 Jun 2011 Link to this post

    Hello Aaron,

    Thank you for sharing your code with us. I have updated your Telerik points for your community effort. If there are any additional questions, I will be glad to help.

    Best wishes,
    Martin Vasilev
    the Telerik team
    Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
  9. Brian@WTG
    Brian@WTG avatar
    13 posts
    Member since:
    Mar 2011

    Posted 15 Jun 2011 Link to this post

    Well.. this was interesting to test but no, it does not solve the issue.

    Yes it works with minimal delay if you are arrowing down or mouse clicking items in the suggestion drop down, it does move the text to a left align in the combo box. I noticed when a value was already selected and you hit the drop down arrow to show the list, the text immediately reverts to right align though..

    The issue originally posted was for auto complete, which is a different suggestion drop down. Auto complete has a little different behavior, and my problem was the user appears to be typing out of the control when the suggestions populate the box.. which made some users confused. Unfortunately when you're using auto complete there isn't a value in the drop down yet, so while the above is true, when I started typing the original behavior still occurred.. so I tried a few other events. Using this example to push a left key to use the cursor make the text align while trying to type for the auto complete suggestion did not work out. I'm sure you can imagine. lol
  10. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 20 Jun 2011 Link to this post

    Hi Brian,

    Unfortunately, there is not an easy workaround for the situation. As Peter already stated
    the inappropriate behavior comes from the hosted TextBox items, which are used also in the standard MS ComboBox control.

    We will consider improvements for one of the further releases, however, I cannot give you a time-frame for that. The best way to overcome the limitation is to consider wider size if your UI allows that.

    Greetings,
    Martin Vasilev
    the Telerik team
    Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
  11. Stefan
    Stefan avatar
    1 posts
    Member since:
    Mar 2012

    Posted 30 Mar 2012 Link to this post

    Hello!

    I managed to resolve this issue with this piece of code:

         private void MultiColumnComboBox_SelectedValueChanged(object sender, EventArgs e)
            {
                if (((MultiColumnComboBox)sender).CurrentObject != null)
                {
                    RadTextBoxItem rtbi = ((RadMultiColumnComboBoxElement)sender.GetChildAt(0)).GetChildAt(2).GetChildAt(0).GetChildAt(0) as RadTextBoxItem;
                    rtbi.SelectionLength = 0;
                }

            }
  12. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 02 Apr 2012 Link to this post

    Hello Stefan,

    Thank you for sharing your solution with the community. However, please note that we do not recommend using the GetChild method to access child elements in our controls. Instead, you can use the following code:
    void MultiColumnComboBox_SelectedValueChanged(object sender, EventArgs e)
    {
        RadMultiColumnComboBox comboBox = (RadMultiColumnComboBox)sender;
        RadTextBoxItem rtbi = (RadTextBoxItem)comboBox.MultiColumnComboBoxElement.TextBoxElement.TextBoxItem;
        rtbi.SelectionLength = 0;
    }

    Kind regards,
    Jack
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  13. Brian@WTG
    Brian@WTG avatar
    13 posts
    Member since:
    Mar 2011

    Posted 02 Apr 2012 Link to this post

    I tried the selectionlength = 0 for the control, but the same issue exists for the auto complete suggestions. Arrowing up or down the bound list does keep the bound list left aligned unless I'm searching the auto complete. Arrowing up or down that list does not do anything different. For now, I just have really long drop down lists. In the attachment I resized the auto complete suggestions box to show there are two active lists.

    Is there a way to use the bound suggestion without auto complete but still have it suggest append?

  14. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 05 Apr 2012 Link to this post

    Hi Brian,

    Thank you for contacting writing.

    This is the expected behavior from RadDropDownList. Setting the SelectionLength property to 0 will remove only the selection in the current moment. For your case I can propose to resize both popups in code in order to show the whole text:
    radDropDownList1.DropDownListElement.AutoCompleteSuggest.DropDownList.DropDownMinSize = new Size(400, 200);
    radDropDownList1.DropDownMinSize = new Size(400, 200);
    I hope this helps. Let me know if this solution is applicable for you.

    Greetings,
    Peter
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  15. Brian@WTG
    Brian@WTG avatar
    13 posts
    Member since:
    Mar 2011

    Posted 05 Apr 2012 Link to this post

    Thanks Peter. I know you've addressed this before so we don't have to rehash it again. It's really for where the user is typing. In the attached picture you can see the highlighted value in the text box is right aligned even though I am still typing while the drop downs change suggestions.

    It has been operational as a long entry field and will have to stay that way at this point.
  16. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 09 Apr 2012 Link to this post

    Hello Brian,

    This behavior comes from the AutoComplete Append mode. When the auto-complete adds the text, this moves the whole text. I can propose only to turn off the AutoComplete Append and set the AutoComplete to Suggest mode.

    Do not hesitate to contact us if you have other questions.

    All the best,
    Peter
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready