Recent

Author Topic: Autocomplete for TRichmemo and tedit  (Read 4458 times)

rretamar

  • New Member
  • *
  • Posts: 39
Autocomplete for TRichmemo and tedit
« on: December 26, 2016, 10:54:29 pm »
Hi.
This is a class for add autocompletion feature to tmemo, tedit and trichmemo components. The original code is write for Delphi, and run into Lazarus without modifications. Include a sample-project and executable. The code use windows api.

Ther use is very simple:

Code: Pascal  [Select][+][-]
  1. Var
  2.   Form1: TForm1;
  3.   AutoComplete1: TAutoComplete;
  4.   AutoComplete2: TAutoComplete;
  5.   AutoComplete3: TAutoComplete;
  6.  
  7. Implementation
  8.  
  9. {$R *.lfm}
  10.  
  11. Procedure TForm1.FormCreate(Sender: TObject);
  12. Begin
  13.   AutoComplete1 := TAutoComplete.Create(self, 'worte.txt', Memo1);
  14.   AutoComplete2 := TAutoComplete.Create(Form1, 'plz.txt', LabeledEdit1);
  15.   AutoComplete3 := TAutoComplete.Create(Form1, 'words4.txt', RichEdit1);
  16. End;  
  17.  
  18.  

Download code from MEGA:

https://mega.nz/#!eAh0lYoT!p4TpiVQbcG8kZX3wiprsldOE61dxGe-08e7vLr7Iehw

Ramon
« Last Edit: January 04, 2017, 01:27:59 pm by rretamar »

m.abudrais

  • Jr. Member
  • **
  • Posts: 52
Re: Autocomplete for TRichmemo and tedit
« Reply #1 on: April 20, 2018, 08:39:07 pm »
thank you for the code.
but the code work only when I change this
Code: Pascal  [Select][+][-]
  1. If l = 0 Then
  2.         Items.Add.Caption := s.Strings[k]
  3.       Else  
to
Code: Pascal  [Select][+][-]
  1. If l = 1 Then
  2.         Items.Add.Caption := s.Strings[k]
  3.       Else  
I have two suggestion:
1- add  a  License.
2- put the code in a site like github or sourceforge.

CM630

  • Hero Member
  • *****
  • Posts: 1082
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Autocomplete for TRichmemo and tedit
« Reply #2 on: January 23, 2020, 01:12:54 pm »

thank you for the code.
but the code work only when I change this

Thanks for sharing, but I have tryed it and:
With @rretamar's original code nothing is shown in the list box.
With @m.abudrais's modification everything (all the words in the dictionary) is shown in the list box.
So it works neither way.


EDIT: It does not work in LabeledEdit1, but with @m.abudrais's modification it works in RichEdit1.
« Last Edit: January 23, 2020, 02:20:21 pm by CM630 »
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

 

TinyPortal © 2005-2018