TComboBox.AutoCloseUp Property: What does it do?
Asked Answered
A

1

7

From the documentations:

Specifies whether the drop-down closes up automatically when the user selects an item.

I have played with this property (combined with AutoComplete and AutoDropDown) and I just can't seem to figure out the UI behavior of this property.

Setting it to True or False I can't see any difference in how it behaves. Can anyone explain to me what it does exactly?

Amman answered 27/5, 2016 at 7:21 Comment(0)
S
6

You will see the difference if you have AutoCloseUp = True and also AutoDropDown = True. For example, if you have items '0', '1' and '2' and the ComoBox has focus, when you use the keyboard and press 2 the dropdown list flashes briefly and is closed again with item '2' selected. If you change AutoCloseUp = False, then the dropdownlist remains open (and you can change your selection with the arrow keys) until you indicate your selection with Enter

If you operate the combo only with your mouse, then there's no difference.


Addition after comments

If you add to my example items '22' and 'more' and you also have AutoComplete = True (which it is by default) you will note the following:

item '22' is not selectable with two consecutive hits on 2. It is of course still selectable with the arrow keys, like all other items.

The AutoCloseUp feature closes the dropdown when AutoComplete finds a matching item for all sofar typed keys. If you type m, o, r the list is still open, 'more' selected and the list is finally closed if you type the missing e.

Sonnnie answered 27/5, 2016 at 7:49 Comment(5)
You can see the difference more clearly if you have strings longer than one character, say "One", "Two", "Three", "Four". Wuth AutoCloseUp = true and combo box has focus type F O U R - as soon as the R is typed close-up happens. If AutoCloseUp = false the window stays open until return is pressed.Soloman
What if 4 and 44 are items? Will it close directly on the first 4?Sodden
Yes @Michael Thanks for the comment, I'll add it to my answer. Anyway, a key factor is also that AutoComplete = True, which it is by default.Sonnnie
@LURD Yes, it will close on the first 4, and 44 will not be possible to enter with the keyboard (except with the arrow keys).Sonnnie
There are a couple of ways you can help improve the documentation. From the online wiki page (docwiki.embarcadero.com/Libraries/Berlin/en/…), you can click Discussion at the top to add comments to the help topic. Or, in the far right of the links at the bottom, you can create a bug report (QP) against the page for the documentation team to review. Note that both the DocWIki Discussion page and the Quality Portal require creating an account if you don't have one.Miserable

© 2022 - 2024 — McMap. All rights reserved.