これは、ハイフネーションライブラリのSynopse delphi open sourceです。delphiでこのハイフネーションライブラリを使用するには?
デモはコンソールアプリケーションです。私はGUIアプリケーションでそれを使う方法を知らない。
以下は私のテストですが、動作しません。ハイフン(またはセパラクタ)の単語は表示されません。 libはdownloaded here:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, hyphen, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
procedure testhyphenator;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
procedure TForm1.testhyphenator;
var
h: THyphen;
s: string;
F, L: Integer;
begin
s := 'hyph_en_US.txt'; //this is from the folder, is that correct to call?
if FileExists(s) then
begin
F := FileOpen(s, fmOpenRead);
L := FileSeek(F, 0, soFromEnd);
if L > 0 then
begin
SetLength(s, L);
FileSeek(F, 0, soFromBeginning);
FileRead(F, s[1], L);
end;
FileClose(F);
end;
h := THyphen.Create(s);
h.Execute('pronunciation'); //is this correct?
ShowMessage(h.filllist); //not display hyphenated word
end;
ハイフネーションされた単語を表示しません。デモでは、コンストラクタについても混乱しています。
H := THyphen.create('ISO8859-1'#10'f1f'#10'if3fa/ff=f,2,2'#10'tenerif5fa');
writeln('"',H.Execute('SchiffahrT'),'"'); writeln(H.FillList);
...
著者はobjファイルも囲んでいます。私はそれを1つのexeファイルにコンパイルしたいのですが、どうすればいいですか?
正しく使用する方法を教えていただけますか?
ありがとうございます。
もっと具体的になりますか? *動作しません*は使用できる問題の最悪の記述です。あなたの質問に* * .objファイルをリンクする方法* '{$ LINK 'ファイルを使用してください。obj '} 'をあなたのユニットに追加します。 – TLama
@TLama、返信ありがとうございます。編集をご覧ください。つまり、ハイフネーションされた単語は表示されません。 – Warren
1)元のコンソールアプリのバージョンをあなたのボックスにコンパイルできましたか? 2)あなたのDelphiのバージョンは何ですか? – menjaraz