autocomplete - Auto append/complete from text file to an edit box delphi -


I am trying to create an edit box and I want the text entered during typing to auto-fill Able to do. The text will be added with a "suggestion" from a text file.

Let's say that my suggestion file contains: Marilyn Monroe Marlon Brando Mike Myers

As I started typing "M", in the edit box, the rest highlight ( Or not) will appear: "Arylin Monroe" and as I keep typing "MI", then "the myers" will appear in the end, I hope I am making this obvious enough for you! Thanks for your help!

You can use this feature easily.

  • Dropbox in your code
  • Autocomplete set the property to True
  • In Follow the steps:
  • sorted property correct
  • style property to csDropDown
  • Set onext combobox event adds a code like this
      const MaxHistory = 200; // Maximum processing of items TForm1.ComboBoxSearchExit (Sender: Toबेस); Start / check that if the text in the written form is entered, then do not add it to the list (trim (combobox search text) & lt; & gt; '') and (combo box search .times. Index (combobox search. ) = 1) Then start the combo box search. Number = count = MaxHistory then combo box search. ITEMS. Delete (combo box search item No. 1); ComboBoxSearch.Items.Insert (0, ComboBoxSearch.Text); End; End;   
    • Save the history of your combo box, for example in the on-close event of your form
       < Code> Process TForm1.FormClose (Sender: Tubect); Start the combo box search. SevToFile (extract file path (Paramastra (0)) + 'History.txt'); End;   
      • You can load saved items at the beginning of your form
          Process TForm1 Forum Create (Sender: Tobias); Var file history: string; Start FileHistory: = ExtractFilePath (ParamStr (0)) + 'History.txt'; If fileExists then search the combo box. ITEM Loophrim file (file history); End;    

  • Comments