Hi Support,
Please shed some light on the usage of ISpellCheckCallbacks.
I'm trying to do some spell checking *from code* - without involving the IPXV_SpellChecker pane, so without the UI part.
After a lot of try-fail hits, I think the following does not work correctly:
1. The CheckWord() method
The CheckWord() method will result in SpellCheckRes_NoLang if the specified LangID is *not* selected in the "Spell Checker Settings" dialog - even though the dictionary does exist and is loaded.
So for example:
nCheckRes = ISpellCheckCallbacks.CheckWord(1033, "spell"); //1033 is en-US
will result in SpellCheckRes_NoLang if the following:
But, having the en-us box checked, as in:
The nCheckRes will be SpellCheckRes_OK.
Q1: Is this a bug? Why would a specific locale need to be checked for CheckWord() to work? If so, how to check it from code?
2. The GetLang() method
I would expect the following call (pseudo):
itLangID = GetLang("it-it",...)
would result in 1040 never mind if the IT dictionary (/.oxt) exists and if the Italian language is checked in Checker Settings. But seems it is not the case. Somehow, as with CheckWord, the GetLang is dependent on Checker Settings.
What's even more strange, if "en-us" is selected in Checker Settings, GetLang("it-it",...) would result in 1033 (which is "en-us" - but has nothing to do with "it-it")
Q2: What is then the real purpose of GetLang()?
And one extra:
Q3. The Get_Capabilities() method - what is it for?
To sum up:
I would expect CheckWord(1033, 'spell') to return SpellCheckRes_OK if the dictionary (dict-en.oxt) is loaded, SpellCheckRes_NoLang if not - never mind if the specific language locale is checked in the Checker Settings dialog or not.
How to "check" a specific locale (like en-us) from code - so the above issue gets duck taped?
p.s.
The 1033 = en-us, 1040 = it-it ... Windows LCID values.
-žarko
Using ISpellCheckCallbacks do to spell check *from code* SOLVED
Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
- TrackerSupp-Daniel
- Site Admin
- Posts: 8605
- Joined: Wed Jan 03, 2018 6:52 pm
Re: Using ISpellCheckCallbacks do to spell check *from code*
Hello, zarkogajic
I had to call in some help from the Dev team for this one, here is what they had to say:
Kind regards,
I had to call in some help from the Dev team for this one, here is what they had to say:
I hope it helps!1. CheckWord function depends on loaded dictionaries in SpellChecker plugin so it will return SpellCheckRes_NoLang if dictionary for nLangID was not loaded. Also code like CheckWord(0, "spell") should work - it will try to find best loaded dictionary for word. Dictionaries can be installed or enabled only by UI in SpellChecker plugin settings.
2. GetLang() method will return possible LangID for specified word depending on loaded dictionaries.
3. get_Capabilities will return flags that indicates if SpellChecker can spell (SpellCheck_Spelling) or hyphenate (SpellCheck_Hyphenation) text.
Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Tracker Software Products (Canada) LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Using ISpellCheckCallbacks do to spell check *from code*
Hi Daniel,
If not possible, how to then call and display the "Spell Checker Settings" dialog from code (and let user enable/disable loaded dictionaries)? Note: I want to avoid using the "spellView" pane - as it is per document - while I need to enable a dictionary in general - not really having ipxv_documents.
The IPXV_SpellChecker does have ShowPrefs() which I guess displays that dialog. However, I do not know how to get my hands on that interface?
-žarko
I have the dictionary installed/loaded but still CheckWord results in SpellCheckRes_NoLang, because of:CheckWord function depends on loaded dictionaries
So, how to enable a loaded/installed dictionary from code?Dictionaries can be installed *or enabled* only by UI
If not possible, how to then call and display the "Spell Checker Settings" dialog from code (and let user enable/disable loaded dictionaries)? Note: I want to avoid using the "spellView" pane - as it is per document - while I need to enable a dictionary in general - not really having ipxv_documents.
The IPXV_SpellChecker does have ShowPrefs() which I guess displays that dialog. However, I do not know how to get my hands on that interface?
-žarko
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: Using ISpellCheckCallbacks do to spell check *from code*
Hi Zarko.
You may use this way:
IPXV_SpellChecker spell = (IPXV_SpellChecker)pxvInst.GetExtension("SpellChecker");
Cheers.
You may use this way:
IPXV_SpellChecker spell = (IPXV_SpellChecker)pxvInst.GetExtension("SpellChecker");
Cheers.
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
Re: Using ISpellCheckCallbacks do to spell check *from code*
Hi Vasyl,
Thanks!
How about enabling dicts from code? Not possible?
-ž
Thanks!
How about enabling dicts from code? Not possible?
-ž
- Vasyl-Tracker Dev Team
- Site Admin
- Posts: 2353
- Joined: Thu Jun 30, 2005 4:11 pm
- Location: Canada
Re: Using ISpellCheckCallbacks do to spell check *from code*
I'm afraid this is not possible at the moment...
Vasyl Yaremyn
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Tracker Software Products
Project Developer
Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
-
- User
- Posts: 1372
- Joined: Thu Sep 05, 2019 12:35 pm
- Tracker Supp-Stefan
- Site Admin
- Posts: 17941
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact: