Page 1 of 2

Spell CHecker

PostPosted: Fri Sep 03, 2021 5:34 pm
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).

Re: Spell CHecker

PostPosted: Fri Sep 03, 2021 5:45 pm
by karinha

Re: Spell CHecker

PostPosted: Fri Sep 03, 2021 11:30 pm
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.

Re: Spell CHecker

PostPosted: Sat Sep 04, 2021 11:01 am
by Antonio Linares

Re: Spell CHecker

PostPosted: Sat Sep 04, 2021 11:37 am
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

Re: Spell CHecker

PostPosted: Sat Sep 04, 2021 9:37 pm
by cnavarro
Checked with TRichEdt class and run ok
Code: Select all  Expand view

#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

Re: Spell CHecker

PostPosted: Fri Nov 12, 2021 12:49 am
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 ?

Re: Spell CHecker

PostPosted: Sun Nov 14, 2021 10:37 pm
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

Re: Spell CHecker

PostPosted: Mon Nov 15, 2021 11:05 pm
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.

Re: Spell CHecker

PostPosted: Tue Nov 16, 2021 8:25 am
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 ?

Re: Spell CHecker

PostPosted: Tue Nov 16, 2021 3:01 pm
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.

Re: Spell CHecker

PostPosted: Wed Nov 17, 2021 7:13 pm
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.

Re: Spell CHecker

PostPosted: Sat Nov 27, 2021 2:18 pm
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.

Re: Spell CHecker

PostPosted: Tue Nov 30, 2021 12:19 am
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.

Re: Spell CHecker

PostPosted: Tue Nov 30, 2021 1:36 am
by Jimmy
hi,
GET or SET Language Options show me blank screens.

this line in Sample "enable" Spellchecker
Code: Select all  Expand view
           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