ComboBox: Text Alignment lazarus / 31-LCL ---------------------------------------------------------------------- iru · 2022-02-11 10:33 Environment: Linux Mint Mare 20... FPC 3..2, Lazarus 2.0.12. Gentlefolk, I have a ComboBox with some items with a text length greater than the length of the  text portion of the ComboBox display. ' If I click on the dropdown 'V' and click on an item the selected item is displayed in the 'edit/display' part of the ComboBox. If the length is greater than the 'edit/display' it is right aligned and the leading/leftmost part is not displayed. Is there anyway to 'left align' any long text after an item selection? Any help appreciated, Ian. ---------------------------------------------------------------------- pebe · 2022-02-11 16:17 Hey This is (probably) happening due to the fact that the content of the "edit/display" field is selected and it is not (as you write) right aligned (although it looks that way). The content of the "edit/display" field is moved to the end of the selection. From what I checked, it doesn't help "AutoSelect:=false" - not sure why (maybe I missed something) After selecting an item from the list, it still selects the text in the "edit/display" field... unless this attribute has a different meaning. However, I suggest you play with the settings of the "selLength", "selStart", "selText" attributes of the ComboBox control. I assume that setting "selLength:=0" after the action of changing or selecting an item from the list should help. Greetings. Let us know if it helped ---------------------------------------------------------------------- iru · 2022-02-13 03:02 Thank you for the response. I had a look at the settings you mentioned and then tried to make use of tComboBox.Maxlength. Maxlength in what units? Points, pixels, characters? It is in text characters so all text placed in tComboBox.Text is truncated to this length and positioned 'left justified'. So how many characters can fit in the width of the ComboBox? If I add some code in ComboBoxSelect(Sender: TObject) which transfers characters from  tComboBox.Items[?] to tComboBox.Text and fiddle MaxLength I can get a left justified part string in the tComboBox display. I find that if MaxLength is greater than the length of the tComboBox display area  (in characters) text transferred from  tComboBox.Items[?] to tComboBox.Text is left justified and truncated nicely to the length of the tComboBox display area. The value of MaxLength does not matter as long it is greater than the number of characters that can be displayed in the tComboBox!!! So, problem solved. Thanks for the input, Ian. ---------------------------------------------------------------------- iru · 2022-02-13 03:23 Whoa, stop!!! The problem is not resolved!!! While testing the code outlined in my previous post I had a breakpoint in ComboBoxSelect(Sender: TObject)  so I could check things. With the breakpoint the text transferred from  tComboBox.Items[?] to tComboBox.Text is left justified and truncated nicely to the length of the tComboBox display area. Remove the breakpoint and the data in the tComboBox display area is NOT left justified. I am more confused than ever! ian.