Index: cprs/branches/HealthSevak-CPRS/CPRS-Lib/Hans SpellCheck/skaSpellCheck.pas
===================================================================
--- cprs/branches/HealthSevak-CPRS/CPRS-Lib/Hans SpellCheck/skaSpellCheck.pas	(revision 1711)
+++ cprs/branches/HealthSevak-CPRS/CPRS-Lib/Hans SpellCheck/skaSpellCheck.pas	(revision 1712)
@@ -89,4 +89,5 @@
     function GetAboutThis: String;
     procedure SaveForUndo(const Ignoring: Boolean=False);
+    procedure ShowBtnClose(const ShowIt: Boolean = True);
   public
     constructor Create(AOwner: TComponent); overload; override;
@@ -159,4 +160,11 @@
 function TskaHunSpellChecker.AbortSpellCheck(Verbose: Boolean = True): Boolean;
 begin
+  if FStatus <> ssChecking then
+  begin
+    FStatus := ssCancelled;
+    Close;
+    exit;
+  end;
+
   Result := (not isModified)  or
             (not Verbose) or (MessageDlg(ConfirmAbort, mtConfirmation,
@@ -165,4 +173,6 @@
   if Result then
     FStatus := ssCancelled;
+
+  ShowBtnClose;
 end;
 
@@ -211,5 +221,5 @@
 begin
   full := SourceTextControl.Lines[CurrentLine];
-  prefix := copy(CurrentText, 1, WordPos-1);
+  prefix := copy(CurrentText, 2, WordPos-2);    //remember there is one extra space at the start of the line prefixed while populating this variable
   Suffix :=  copy(CurrentText, WordPos+WordLength,
                            length(CurrentText));
@@ -228,4 +238,5 @@
   Initialize;
   WaitForUser := False;
+  FStatus := ssChecking;
   SourceTextControl.Invalidate;
   Result := not WaitForUser;
@@ -251,4 +262,5 @@
  SourceTextControl.Invalidate;
  //SourceTextControl.Invalidate;
+ ShowBtnClose(False);
 end;
 
@@ -403,4 +415,18 @@
     uHunSpellLib.hunspell_suggest_free(FpointerHunLib, suggestions, Count);
   end; 
+end;
+
+procedure TskaHunSpellChecker.ShowBtnClose(const ShowIt: Boolean);
+begin
+  if Assigned(btnClose) then
+  begin
+   btnClose.Enabled := ShowIt;
+   btnClose.Visible := ShowIt;
+   if ShowIt then
+   begin
+     btnClose.BringToFront;
+     btnClose.SetFocus;
+   end;
+  end;
 end;
 
@@ -508,6 +534,7 @@
     begin
       FStatus := ssCompleted;
-      if Assigned(btnClose) then
-        btnClose.Click;
+      if ShowCompletionMessage then
+        ShowMessage(CompletionMessage);
+      ShowBtnClose;
     end;
     {$R+}
