Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Основная";
Текущий архив: 2003.09.11;
Скачать: [xml.tar.bz2];

Вниз

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;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.45 MB
Время: 0.009 c
1-33655
qwerty2
2003-09-01 16:39
2003.09.11
Как избавиться от песочных часов в курсоре


1-33555
Lamerr
2003-08-29 09:26
2003.09.11
Изменение Options StringGrid-а в ран-тайм


14-33768
olegraw
2003-08-23 21:43
2003.09.11
Borland Delphi 7 Developer s Guide


7-33819
MW Programs
2003-06-24 17:32
2003.09.11
Windows XP


1-33644
Menel
2003-09-01 16:27
2003.09.11
Узнать имя картинки загруженной в Image





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский