Frequently Asked Component Specific Questions
Options |
Display all FAQ items |
Displaying items 1 to 1 of 1, page 1 of 1
<< previous next >>
TAdvEdit
Using the built-in lookup & autocompletion capabilities
Using the built-in lookup & autocompletion capabilities
Just like in Outlook when you start typing an email address, Outlook makes a suggestion while typing on possible matching email addresses, TAdvEdit has such capability. The settings to control this lookup or autocompletion capability can be found under TAdvEdit.Lookup. The default and most simple behavior of the lookup is to add entries in the Edit.Lookup.DisplayList stringlist.
This code snippet initializes the lookup with display text and value text. When typing ''Fe'', the dropdown list will suggest ''Ferrari'' and when accepting to autocomplete, the edit control text will be set to ''http://ferrari.it'':
begin with AdvEdit1.Lookup do begin DisplayList.Clear; ValueList.Clear; DisplayList.Add(''BMW''); ValueList.Add(''http://www.bmw.de''); DisplayList.Add(''Mercedes''); ValueList.Add(''http://www.mercedes.de''); DisplayList.Add(''Porsche''); ValueList.Add(''http://www.porsche.de''); DisplayList.Add(''Ferrari''); ValueList.Add(''http://www.ferrari.it''); DisplayList.Add(''Audi''); ValueList.Add(''http://www.audi.de''); end; AdvEdit1.Lookup.Enabled := true; end;
When Lookup.History is set to true, values entered in the edit control are automatically added to the DisplayList. This DisplayList can be persisted in the registry or in an INI file. To enable this capability, set AdvEdit.Persistence.Enable is true and specify the registry key or INI filename via AdvEdit.Persistence.Key and the registry value name or INI file section name with AdvEdit.Persistence.Section.