Forum > LCL

TComboBox.AutoSelect has no effect

(1/2) > >>

RolfW:
Hi,
the TComboBox.Text is always selected (receiving focus/selecting an item) regardless of the AutoSelect setting. Don't understand what's meant by "The Enter key is pressed" in the help file. Can't see that "Enter" has any effect.
Thanks,
Rolf

jamie:
AutoSelect just makes what ever is in the EDIT portion of the Tcombobox become selected when you move
from one control to this control.

 The Docs state the Text property is what is currently showing in the EdIT box of the combobox.

RolfW:
Hi jamie,
I've set AutoSelect to false. But the text in the edit protion of the ComboBox is selected regardless of this setting when the combobox is focused.
Rolf

ASerge:

--- Quote from: RolfW on February 09, 2018, 10:16:50 am ---I've set AutoSelect to false. But the text in the edit protion of the ComboBox is selected regardless of this setting when the combobox is focused.

--- End quote ---
I do not know how on other platforms, but in Windows text selection in ComboBox is the default behavior. LCL with AutoSelect = True additionally selects all the text. In order to change the default behavior, in the OnEnter handler, put

--- Code: Pascal  window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---(Sender as TComboBox).SelLength := 0;In this case, the behavior will depend on the AutoSelect property.

RolfW:
Meanwhile I've created a TComboBox descended component (TRWComboBox) which acts on activation in the same way as a TEdit control does (Windows, csDropDown, AutoSelect=false):
  - Nothing is selected at activation
  - Activation by key: The previous selection is restored
  - Activation by mouse: The selection follows the mouse cursor

It's Windows only. I think this is a Windows only problem.

Source code attached. Any response is welcome.

Rolf

Navigation

[0] Message Index

[#] Next page

Go to full version