Lazarus

Programming => Packages and Libraries => RichMemo => Topic started by: legroumf on March 01, 2016, 12:38:14 am

Title: Add of spell check to richmemo component
Post by: legroumf on March 01, 2016, 12:38:14 am
Hello,
I am working on adding spell checking to RichMemo component using the  NHunspell and I need testers  :)

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
USE :
The dll Hunspellx86.dll must be at the root of your application.
Drag and drop the component as usual.
Indicate in the property  « PathtoOXT » the folder where the dictionaries are installed  OXT  («.\ dic\ » by default).
English and French dictionaries are provided.
To download more dictionaries:
http://extensions.libreoffice.org/extension-center?getCategories=Dictionary

-1/ Spell checking window :
In the event  OnClick of an button or in the  OnExecute of an ActionList with « F7 »  as a shortcut key  write  :

RichMemo1.SpellCheckForm;

If multiple dictionaries installed, you can select the one you want from the ComboBox spell checking window; the change will immediately take effect.
At the next window opens, your final choice will be selected.

-2/ Coloring in red misspelled words.
You can use the procedure
RichMemo1.Color_Spelling_Mistake
to color in red misspelled words  ( see \samples\spellCheck for an example ).

-3/ Get list of spelling suggestions for a misspelled word
You can use the procedure

SuggestList(const selword: string; SList: TstringList);

for get list of spelling suggestions for a misspelled word
for example :

RichMemo1.SuggestList(RichMemo1.SelText,List);

See \samples\spellCheck for an example of interaction with a popupmenu.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=

http://dl.free.fr/fveWraDIG (http://dl.free.fr/fveWraDIG)

legroumf@yahoo.fr

Thank you for your future suggestions.
Title: Re: Add of spell check to richmemo component
Post by: wp on March 01, 2016, 12:42:18 am
Maybe I do not understand correctly because you don't show any code. But I think it is not a good idea to modify TRichMemo such that it requires an external dll. Not every user of the component needs or wants the spell check.
Title: Re: Add of spell check to richmemo component
Post by: legroumf on March 01, 2016, 12:56:10 am
Hello,
I added three more procedures to the original code and a form containing the phrases
misspellings and list suggestions etc (as in LibreOffice).
Thus exposing the code here would be a little heavy I think.
About the usefulness, the use of added procedures is, of course, not mandatory and it is the same for the dll.
Title: Re: Add of spell check to richmemo component
Post by: Raf20076 on April 14, 2017, 01:31:12 pm
 :) It's a good work when it comes to spellchecker but I am just thinking can anybody transform legroumf component into separate checkspell component.?

It seems to me that so far no one was really able to write a spellcheck component apart from legroumf who did it nicely but only for Richmemo. However it could be the base for spellchecker component itself.

Or maybe any idea to to crack this.

Thanks

Title: Re: Add of spell check to richmemo component
Post by: Raf20076 on July 22, 2017, 10:39:08 am
I can see that this is based on https://sourceforge.net/projects/nhunspelldelphi/

It's a good direction to develop spellchecking component but I have noticed error in working. For example when I use polish dictionary pl-dict it shows Portuguese (Portugal) should be Polish(Poland)and there are no polish letters like łąśćżźę etc intead of there are blank spaces for example  jabłko (apple) it shows jab ko.

I have found also this https://sourceforge.net/projects/hunspell-delphi/?source=directory

http://www.delphicode.co.uk/delphi-spell-check/

Thanks