This is a migrated thread and some comments may be shown as answers.

Selected values don't hold alignment

14 Answers 451 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Brian@WTG
Top achievements
Rank 2
Brian@WTG asked on 08 Mar 2011, 03:11 PM
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

14 Answers, 1 is accepted

Sort by
0
Jason Parrish
Top achievements
Rank 1
answered on 08 Mar 2011, 10:49 PM
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.
0
Brian@WTG
Top achievements
Rank 2
answered on 10 Mar 2011, 05:43 PM
For now I just widened the control to cover 95% of the available values.
0
Accepted
Peter
Telerik team
answered on 11 Mar 2011, 05:39 PM
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!
0
Brian@WTG
Top achievements
Rank 2
answered on 11 Mar 2011, 05:50 PM
I currently have VS2008 so I can't open that project, but thank you.
0
Aaron
Top achievements
Rank 1
answered on 10 Jun 2011, 07:19 PM
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.
0
Martin Vasilev
Telerik team
answered on 15 Jun 2011, 03:25 PM
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.
0
Brian@WTG
Top achievements
Rank 2
answered on 15 Jun 2011, 04:01 PM
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
0
Martin Vasilev
Telerik team
answered on 20 Jun 2011, 03:28 PM
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.
0
Stefan
Top achievements
Rank 1
answered on 30 Mar 2012, 08:54 AM
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;
            }

        }
0
Jack
Telerik team
answered on 02 Apr 2012, 10:44 AM
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 >>
0
Brian@WTG
Top achievements
Rank 2
answered on 02 Apr 2012, 02:13 PM
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?

0
Peter
Telerik team
answered on 05 Apr 2012, 11:17 AM
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 >>
0
Brian@WTG
Top achievements
Rank 2
answered on 05 Apr 2012, 01:43 PM
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.
0
Peter
Telerik team
answered on 09 Apr 2012, 01:40 PM
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 >>
Tags
DropDownList
Asked by
Brian@WTG
Top achievements
Rank 2
Answers by
Jason Parrish
Top achievements
Rank 1
Brian@WTG
Top achievements
Rank 2
Peter
Telerik team
Aaron
Top achievements
Rank 1
Martin Vasilev
Telerik team
Stefan
Top achievements
Rank 1
Jack
Telerik team
Share this question
or