Spell CHecker

User avatar
TimStone
Posts: 2954
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Has thanked: 25 times
Been thanked: 2 times
Contact:

Spell CHecker

Post by TimStone »

Many years ago I started integrating the Sentry Spell Checker ( Wintergreen Software ) into my application. They took the same SDK ( 32 bit ) and compiled it for 64bit systems, and then charged a $530 US upgrade fee. That seemed too steep so I have not done it. My clients want a spell checker in the program, so I didn't update my builds to 64 bit.

In doing some research this week, it would appear that Windows has an API that allows us to use the built in spell checker. Has anyone done any implementation of this ? If not, is anyone up to the challenge of making a library for FWH that allows us to use it ?

If I'm being inaccurate, what are others using as a spell checking tool in their programs. Surely your clients want this capability.

Thanks for your input(s).
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
Posts: 2954
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Has thanked: 25 times
Been thanked: 2 times
Contact:

Re: Spell CHecker

Post by TimStone »

I reviewed those but they all seem to go back to the same option which is to create a document in Word.

I add text to a memofield, press a spell check button, and the SDK checks the contents and allows for corrections. Having to go to Word intruduces a whole new layer of difficulty, especially since many of my clients do not have it.

Perhaps others have explored this.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
Antonio Linares
Site Admin
Posts: 42513
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 73 times
Contact:

Re: Spell CHecker

Post by Antonio Linares »

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 42513
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 73 times
Contact:

Re: Spell CHecker

Post by Antonio Linares »

Much simpler :-)

It seems as all we need is to send a certain message to a RichEdit control:

IMF_SPELLCHECKING
Windows 8: If this flag is set, the rich edit control turns on spell checking. This option is turned off by default (0).

https://docs.microsoft.com/en-us/windows/win32/controls/em-setlangoptions

https://docs.microsoft.com/en-us/windows/win32/controls/em-getlangoptions
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
cnavarro
Posts: 6557
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: Spell CHecker

Post by cnavarro »

Checked with TRichEdt class and run ok

Code: Select all | Expand


#define EM_GETLANGOPTIONS  (WM_USER + 121)
#define EM_SETLANGOPTIONS  (WM_USER + 120)
#define IMF_SPELLCHECKING   0x0800
            MENUITEM "EM_GETLANGOPTIONS" ACTION MsgInfo( SendMessage( oRtf:hWnd, EM_GETLANGOPTIONS, 0, 0 ) )
            MENUITEM "EM_SETLANGOPTIONS" ACTION MsgInfo( SendMessage( oRtf:hWnd, EM_SETLANGOPTIONS, 0, IMF_SPELLCHECKING ) )
 

Thanks Antonio
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
TimStone
Posts: 2954
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Has thanked: 25 times
Been thanked: 2 times
Contact:

Re: Spell CHecker

Post by TimStone »

Can you be more specific where you implemented this ? I wanted to test it with RichEdit5 but am not sure to what .prg, and where, you are adding this ?
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
cnavarro
Posts: 6557
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Been thanked: 3 times

Re: Spell CHecker

Post by cnavarro »

Try with this sample
https://bitbucket.org/fivetech/fivewin- ... strtf5.zip
1.- Open any .rtf file
2.- MENU - FILE - EM_SETLANGOPTIONS
3.- Write in your document any word in spanish or other language or any word incorrect
Tell me if run ok for you
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
TimStone
Posts: 2954
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Has thanked: 25 times
Been thanked: 2 times
Contact:

Re: Spell CHecker

Post by TimStone »

Thank you. When doing step 2, nothing displays to "set".

When I type in an error, it shows the line underneath the mispelled word but there is no dictionary or spelling correction offered.

You mentioned using an .RTF file. In the past, RichEdit was supposed to work with MEMO ( .FPT ) fields but I never was successful with that. Is that a possiblility now, or would we need to only use .rtf files? My goal has been to take "boring" text stored in the .fpt files, be able to make them "look nicer" in RTF, and keep them stored in the .FPT file. Initially that file would be a mix of plain text and RTF. I was told it was possible, but never got it to save.

Thanks for responding.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
Antonio Linares
Site Admin
Posts: 42513
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 73 times
Contact:

Re: Spell CHecker

Post by Antonio Linares »

Dear Tim,

When I type in an error, it shows the line underneath the mispelled word but there is no dictionary or spelling correction offered.


Have you tried to left click on such line ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
TimStone
Posts: 2954
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Has thanked: 25 times
Been thanked: 2 times
Contact:

Re: Spell CHecker

Post by TimStone »

I have tried all combinations of clicks, right, left, single, double. It sees the word misspelled but offers no dictionary options are displayed.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
Posts: 2954
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Has thanked: 25 times
Been thanked: 2 times
Contact:

Re: Spell CHecker

Post by TimStone »

I would like to clarify my questions:

1). The spell checker, in this example, does underline inorrectly spelled words, but it does not provide any alternatives.

2) What is the purpose of SET_LANG_OPTIONS

3). The same capability for checking spelling does not seem to apply to the FUNCTION. Is it doable ?

4). Can this work with existing .FPT files to retrieve and save RichText formatted text ?

Thank you.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Spell CHecker

Post by nageswaragunupudi »

1). The spell checker, in this example, does underline inorrectly spelled words, but it does not provide any alternatives.

Yes.

2) What is the purpose of SET_LANG_OPTIONS

There are many options that can be set.
For list, please see :https://docs.microsoft.com/en-us/windows/win32/controls/em-getlangoptions

Out of all the options, only the IMF_SPELLCHECKING option is useful to us.
In case you are programming for touch keyboard, other option IMF_TKBAUTOCORRECTION may interest you.

3). The same capability for checking spelling does not seem to apply to the FUNCTION. Is it doable ?

Which Function?

4). Can this work with existing .FPT files to retrieve and save RichText formatted text ?

Yes.
Regards

G. N. Rao.
Hyderabad, India
User avatar
TimStone
Posts: 2954
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA
Has thanked: 25 times
Been thanked: 2 times
Contact:

Re: Spell CHecker

Post by TimStone »

I was told to build testrtf5.prg in the last Samples folder. I did that. ( 64 bit )

GET or SET Language Options show me blank screens.

I tried putting in IMF_SPELLCHECKING=1 which I assume would turn it on, but it doesn't save the value.

Again, I'm working with FWH64, Harbour64, and MSVS 2022 in Windows 11.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: Spell CHecker

Post by Jimmy »

hi,
GET or SET Language Options show me blank screens.

this line in Sample "enable" Spellchecker

Code: Select all | Expand

           MENUITEM "EM_SETLANGOPTIONS" ;
               ACTION ( SendMessage( oRtf:hWnd, EM_SETLANGOPTIONS, 0, nOr( IMF_SPELLCHECKING, IMF_TKBPREDICTION, IMF_TKBAUTOCORRECTION ) ) )


I tried putting in IMF_SPELLCHECKING=1 which I assume would turn it on, but it doesn't save the value.

as you can see you need SendMessage() to "enable" it

p.s. work also with HMG and Xbase++ but IMF_TKBAUTOCORRECTION only with Table-PC
greeting,
Jimmy
Post Reply