Текущий архив: 2003.09.11;
Скачать: CL | DM;
Вниз
TCombobox Найти похожие ветки
← →
muravey (2003-08-31 14:41) [0]Народ, привет.
Есть такая задача: нужно немного модифицировать объект TCombobox чтобы при наборе текста в нем автоматически подставлялись значения из его списка, имеющие похожую начальную часть.
Здесь можно,конечно, написать обработчик событий onChange который будет перебирать значения из списка, находить соответствующие критерию поиска и подставлять их.
Но можно заметить что если в TCombobox набрать хотя бы одну букву, а затем нажать на кнопку, раскрывающую его он сам автоматически подставит соответствующий вариант из своего списка. Может кто-нибудь знает какое сообщение нужно послать на его handle, что произошло тоже самое?
← →
Андрей Сенченко (2003-08-31 14:43) [1]Пошукай в FAQ и кладовке. С полгода назад эта тема была подробно описана и должна была туда попасть.
← →
Song (2003-08-31 15:21) [2]Дак есть же уже:
Specifies whether the drop-down list drops down automatically in response to user keystrokes.
property AutoDropDown: Boolean;
Description
When AutoDropDown is True, the combo box automatically drops down its list when the user starts typing a string while the combo box has focus.
When AutoDropDown is False, the user must explicitly use the drop-down button to drop down the combo box list.
Specifies whether the combo box automatically completes words that the user types by selecting the first item that begins with the currently typed string.
property AutoComplete: Boolean;
Description
When AutoComplete is True, the combo box responds to user keystrokes by searching the Items property array for the first item that matches the string entered so far. If it finds an item that begins with the prefix typed so far, the combo box selects that item, “completing” the user’s typing. If the user continues to type, selection may move to another, later, item, as the currently typed prefix no longer matches the initial AutoComplete selection. If the user types a string that is not the prefix of a string in the combo box, the string is taken as a unique entry and none of the items in the list are selected.
When AutoComplete is False, this feature is disabled. Strings that the user types are taken literally, with no attempt to match them to a string in the combo box. Setting AutoComplete to False is necessary if you want to allow the user to enter a value that is not in the Items list but that is a prefix on one of the items.
← →
muravey (2003-08-31 17:21) [3]song, ты прав, но только в версиях Delphi ниже 6-й такого точно нет
← →
TButton (2003-08-31 18:00) [4]не мучайся, пиши onChange, полезно иногда мозгами (и пальцами) по скрипеть, для общего знаешь ли развития...
← →
Юрий Зотов (2003-08-31 19:05) [5]> Здесь можно,конечно, написать обработчик событий onChange
> который будет перебирать значения из списка, находить
> соответствующие критерию поиска и подставлять их.
Один из полезнейших принципов грамотного программирования (и не только его) гласит: "Пусть работает медведь, у него четыре лапы".
См. CB_FINDSTRING, CB_SELECTSTRING.
:о)
Страницы: 1 вся ветка
Текущий архив: 2003.09.11;
Скачать: CL | DM;
Память: 0.45 MB
Время: 0.009 c