| [1681] | 1 | unit fSpellNotify; | 
|---|
|  | 2 |  | 
|---|
|  | 3 | interface | 
|---|
|  | 4 |  | 
|---|
|  | 5 | uses | 
|---|
|  | 6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, | 
|---|
|  | 7 | Dialogs, StdCtrls, uConst, ExtCtrls; | 
|---|
|  | 8 |  | 
|---|
|  | 9 | type | 
|---|
|  | 10 | TfrmSpellNotify = class(TForm) | 
|---|
|  | 11 | lblMain: TLabel; | 
|---|
|  | 12 | tmrMain: TTimer; | 
|---|
|  | 13 | lblOptions: TLabel; | 
|---|
|  | 14 | procedure FormCreate(Sender: TObject); | 
|---|
|  | 15 | procedure FormShow(Sender: TObject); | 
|---|
|  | 16 | procedure Refocus(Sender: TObject); | 
|---|
|  | 17 | procedure FormMouseDown(Sender: TObject; Button: TMouseButton; | 
|---|
|  | 18 | Shift: TShiftState; X, Y: Integer); | 
|---|
|  | 19 | private | 
|---|
|  | 20 | FSpellCheck: boolean; | 
|---|
|  | 21 | FEditControl: TCustomMemo; | 
|---|
|  | 22 | FFirst: boolean; | 
|---|
|  | 23 | procedure WMMove(var Message: TWMMove); message WM_MOVE; | 
|---|
|  | 24 | procedure UMDoSpellCheck(var Message: TMessage); message UM_MISC; | 
|---|
|  | 25 | public | 
|---|
|  | 26 | property SpellCheck: boolean read FSpellCheck write FSpellCheck; | 
|---|
|  | 27 | property EditControl: TCustomMemo read FEditControl write FEditControl; | 
|---|
|  | 28 | end; | 
|---|
|  | 29 |  | 
|---|
|  | 30 | implementation | 
|---|
|  | 31 |  | 
|---|
|  | 32 | uses uSpell, ORFn; | 
|---|
|  | 33 |  | 
|---|
|  | 34 | {$R *.dfm} | 
|---|
|  | 35 |  | 
|---|
|  | 36 | procedure TfrmSpellNotify.Refocus(Sender: TObject); | 
|---|
|  | 37 | begin | 
|---|
|  | 38 | RefocusSpellCheckWindow; | 
|---|
|  | 39 | end; | 
|---|
|  | 40 |  | 
|---|
|  | 41 | procedure TfrmSpellNotify.FormCreate(Sender: TObject); | 
|---|
|  | 42 | begin | 
|---|
|  | 43 | FFirst := True; | 
|---|
|  | 44 | end; | 
|---|
|  | 45 |  | 
|---|
|  | 46 | procedure TfrmSpellNotify.FormMouseDown(Sender: TObject; Button: TMouseButton; | 
|---|
|  | 47 | Shift: TShiftState; X, Y: Integer); | 
|---|
|  | 48 | begin | 
|---|
|  | 49 | RefocusSpellCheckWindow; | 
|---|
|  | 50 | end; | 
|---|
|  | 51 |  | 
|---|
|  | 52 | procedure TfrmSpellNotify.FormShow(Sender: TObject); | 
|---|
|  | 53 | begin | 
|---|
|  | 54 | if FFirst then | 
|---|
|  | 55 | begin | 
|---|
|  | 56 | FFirst := False; | 
|---|
|  | 57 | if not SpellCheck then | 
|---|
|  | 58 | begin | 
|---|
|  | 59 | lblMain.Caption := 'Grammar Check Running'; | 
|---|
|  | 60 | lblOptions.Visible := false; | 
|---|
|  | 61 | end; | 
|---|
|  | 62 | PostMessage(Handle, UM_MISC, 0, 0); | 
|---|
|  | 63 | end; | 
|---|
|  | 64 | RefocusSpellCheckWindow; | 
|---|
|  | 65 | end; | 
|---|
|  | 66 |  | 
|---|
|  | 67 | procedure TfrmSpellNotify.UMDoSpellCheck(var Message: TMessage); | 
|---|
|  | 68 | begin | 
|---|
|  | 69 | InternalSpellCheck(SpellCheck, EditControl); | 
|---|
|  | 70 | ModalResult := mrOK; | 
|---|
|  | 71 | end; | 
|---|
|  | 72 |  | 
|---|
|  | 73 | procedure TfrmSpellNotify.WMMove(var Message: TWMMove); | 
|---|
|  | 74 | begin | 
|---|
|  | 75 | inherited; | 
|---|
|  | 76 | RefocusSpellCheckWindow; | 
|---|
|  | 77 | end; | 
|---|
|  | 78 |  | 
|---|
|  | 79 | end. | 
|---|