Probem using the RV Edit OnSpellingCheck event

General TRichView support forum. Please post your questions here
Post Reply
jamiemi
Posts: 21
Joined: Sun Oct 30, 2005 3:33 pm

Probem using the RV Edit OnSpellingCheck event

Post by jamiemi »

Hello All:

I am having a problem with TRichViewEdit and EDDSpell working together nicely. It appears to be some kind of race condition.

It appears to have to do with the OnSpellingCheck event. As far as I can tell, the problem occurs when the event is connected to the following handler:

procedure TfrmDBDlg.RVSpellingCheckEvent(Sender: TCustomRichView;
const AWord: string; StyleNo: Integer; var Misspelled: Boolean);
begin
Misspelled := frmMain.dlgSpell.IsBadWord(AWord);
end;

When this handler is connected, I get the wavy lines underneath as expected for misspelled words. As long as the focus is not taken off the richviewedit, it works OK. Then, if the focus is removed to go to another control, the system freezes up. The error cannot be debugged, I only get the CPU screen with no invocation stack to troubleshoot. It freezes the process when this occurs. Removing the event handler causes the system to work correctly. In both cases, explicitly doing a spell check works fine - no hint of trouble whether the event handler is connected or not.

Interestingly, the problem as described happens when the control is created at run time dynamically. If the control is created during design time, it appears to work correctly - wavy lines appear as expected and you can change context as desired. However, when shutting down the app, I get the following error: EOSError with message 'System Error. Code: 5. Access is denied.'" Again, removing the event handler makes that problem go away.

I am using:

Version 7 of EDSS
Delphi 2005 Build 2600 Service Pack 2
RichView Version 1.9

This exact same code worked really good in Delphi 5.

jamie
Stef
Posts: 90
Joined: Mon Aug 29, 2005 9:56 am
Contact:

Post by Stef »

this seems exactly the problem I've,
see my other post in this forum.
cheers,
jamiemi
Posts: 21
Joined: Sun Oct 30, 2005 3:33 pm

Post by jamiemi »

Looking through your thread, it really does appear to be the same type problem. Please let me know if you come up with a solution. I started noticing this on my development machine immediately after upgrading hardware - I now have a very fast machine with a lot of RAM.
Stef
Posts: 90
Joined: Mon Aug 29, 2005 9:56 am
Contact:

Post by Stef »

the solution is in the thread too,
use somekind of intermediate variable,
I used a simple integer "Spell_language<=0",
instead of the combobox.itemindex,
and everything works fine
(also the real spellchecker, of which the code is not shown)

cheers,
jamiemi
Posts: 21
Joined: Sun Oct 30, 2005 3:33 pm

We are using different spell modules (I think)

Post by jamiemi »

Hi Stef:

I don't see how to do with my code what you did with yours.

My speller is EDDSpell and my code for handling the event looks like this:

procedure TfrmDBDlg.RVSpellingCheckEvent(Sender: TCustomRichView;
const AWord: string; StyleNo: Integer; var Misspelled: Boolean);

begin
Misspelled := frmMain.dlgSpell.IsBadWord(AWord);
end;

Even replacing Misspelled with a local and then setting it did not effect the behavior.

Are there any specific compiler settings that might cause this kind of a problem? I am just starting to use Delphi 2005; did not seem to have these problems in Delphi 5.

jamie
Stef
Posts: 90
Joined: Mon Aug 29, 2005 9:56 am
Contact:

Post by Stef »

apparently you've different events ???
here is my full code, (inclusive bug notice ;-) )
But I'm almost certain, Sergey will come up with a perfect solution !

Code: Select all

procedure Tform_rve_edit.RVESpellingCheck(Sender: TCustomRichView;
  const AWord: String; StyleNo: Integer; var Misspelled: Boolean);
(*******************************************************************************
*******************************************************************************)
begin
  misspelled:=false;
  //due to a bug in RVE  (1.9.24), it's not allowed to use combobox.itemindex !!
  if (Spell_language<=0) or not(Speller_available) then exit;

  if spellchecker_ignorelist.IndexOf(Aword)>=0 then exit;

  misspelled:=not(spellchecker1.IsKnownWord(Aword,Spellchecker1.Language));
end;

jamiemi
Posts: 21
Joined: Sun Oct 30, 2005 3:33 pm

Different spell checker

Post by jamiemi »

The event is the same, but my EDDSpell does not seem to have the same calls that you are making in yours.

Not to be presumptive, but if there are problems with 2 different spell modules, I think we can assume a bug in the RV code or in the Delphi generated code using it.

I don't want to count that out, mainly because this seemed to work in Delphi 5.

jamie
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Do you call dlgSpell.OpenDictionary in FormCreate?
jamiemi
Posts: 21
Joined: Sun Oct 30, 2005 3:33 pm

dlgSpell.OpenDictionary

Post by jamiemi »

You got it. I was not opening it; tracing down the code, the rest of the spelling code worked because it automagically checked for the dictionary being opened and then opened it when it wasn't. Looking back at my old code, I did open it there.

Thanks so much.

jamie
Post Reply