home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog 11
/
Freelog011.iso
/
BestOf
/
PhoenixMail
/
Source
/
spell
/
Main.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1999-02-10
|
3KB
|
107 lines
{*****************************************************************************
*
* Main.pas - Phoenix Mail Spell Checker MainForm
*
* Copyright (c) 1998-99 Michael Haller
*
* Based on VisualSpeller ActiveX Control of Visual Components, Inc.
* Thanks to Richard Kuzsma for his tips and his demo source code
*
* Author: Michael Haller
* E-mail: michael@discountdrive.com
* Homepage: http://www.discountdrive.com/sunrise
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
*----------------------------------------------------------------------------
*
* Revision history:
*
* DATE REV DESCRIPTION
* ----------- --- ----------------------------------------------------------
*
*****************************************************************************}
unit Main;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
OleCtrls, vcspell3, StdCtrls;
type
TMainForm = class(TForm)
VSpell: TVSSpell;
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function CheckSpell: Boolean;
end;
var
MainForm: TMainForm;
implementation
{$R *.DFM}
function TMainForm.CheckSpell: Boolean;
var
ResCode : Integer;
begin
Result := False;
try
if Memo1.Text = '' then Exit;
VSpell.ClearCounts := 1;
VSpell.CheckText := Memo1.Text;
ResCode := VSpell.ResultCode;
while ResCode <> 0 do begin // loop until spellcheck complete
if ResCode > 1 then begin
// Error condition
MessageDlg('An error occurred when trying to check the spell!', mtError, [mbOK], 0);
Exit;
end;
case ResCode of
VSR_WORD_MISSPELLED, VSR_IGNORE_REPLACE: begin
VSpell.PopUpWordMisspelled := 1;
VSpell.ResultCode;
end;
VSR_CHECK_CANCELED: Break;
end;
ResCode := VSpell.ResumeCheck;
end;
Memo1.Text := VSpell.Text;
Result := True;
except
MessageDlg('An error occurred when trying to check the spell!', mtError, [mbOK], 0);
end;
end;
procedure TMainForm.FormCreate(Sender: TObject);
begin
Caption := Application.Title;
Icon := Application.Icon;
Width := 0;
Height := 0;
Left := -100;
Top := -100;
VSpell.DialogBgColor := ColorToRGB(clBtnFace);
end;
end.