[Lazarus] UTF8Tools problem
Vojtěch Čihák
vojtech.cihak at atlas.cz
Sat Sep 30 02:59:29 CEST 2017
Hi,
I have this code for improved autocomplete of TCombo:
var i, aCharMatch, aIndex: Integer;
aCmbText, aItemStr: TUTF8Scanner;
aStr: string;
begin
with TStringGrid(TComboBox(Sender).Parent) do
if TComboBox(Sender).ItemIndex>=0
then Cells[Col, Row]:=TComboBox(Sender).Items[TComboBox(Sender).ItemIndex] { item matched by Combo }
else
begin { try match item by UTF8Scanner }
if TComboBox(Sender).Items.Count>0 then
begin
aIndex:=0;
aStr:=UTF8lowercase(trim(TComboBox(Sender).Text));
if aStr<>'' then
begin
aCmbText:=TUTF8Scanner.Create(aStr);
aItemStr:=TUTF8Scanner.Create;
aCharMatch:=1;
for i:=0 to TComboBox(Sender).Items.Count-1 do
begin
aItemStr.UTF8String:=UTF8lowercase(TComboBox(Sender).Items[i]);
while (not aCmbText.Done) and (not aItemStr.Done) do
begin
if aCmbText.Next=aItemStr.Next then
if aCmbText.CharPos>aCharMatch then
begin
inc(aCharMatch);
aIndex:=i;
end;
end;
aCmbText.Reset;
end;
aCmbText.Free;
aItemStr.Free;
end;
TComboBox(Sender).ItemIndex:=aIndex;
Cells[Col, Row]:=TComboBox(Sender).Items[aIndex];
end;
end;
It uses UTF8tools http://wiki.lazarus.freepascal.org/UTF8_Tools by Theo.
I tried to compile project after while (few month) and I have got this error message:
unicodeinfo.pas(1180,53) Error: Wrong number of parameters specified for call to "UnicodeToUtf8"
Error: Found declaration: UnicodeToUtf8(PChar;PUnicodeChar;Int64):Int64;
Question is: How can I repair unicodeinfo.pas? Or better, can I do the same job without UTF8Tools package?
Thanks for help,
V.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20170930/7a3046f8/attachment.html>
More information about the Lazarus
mailing list