Welcome Guest Search | Active Topics | Sign In | Register

SpellChecker for EO.WebBrowser Options
KimKamp
Posted: Wednesday, March 29, 2017 10:02:35 AM
Rank: Advanced Member
Groups: Member

Joined: 3/13/2017
Posts: 33
I am using the EO.WebBrowser (NOT the EO.Web) plugin in my Windows desktop program.

When I right-click on a word that the Dictionary does not know, I get a menu item that offers me a link to the Essental Objects home page.

How do I have a right-click on an unknown word open up a Dictionary menu?

KimKamp
Posted: Wednesday, March 29, 2017 11:12:52 AM
Rank: Advanced Member
Groups: Member

Joined: 3/13/2017
Posts: 33
Ok. easy answer. I commented out all of the BeforeContextMenuEventArgs. This solves the problem for now, but it also appears that I won't be able to add any custom menu commands until the SpellChecker menu item can be added to EO.WebBrowser like it is available in EO.Web.

Private Sub WebView_BeforeContextMenu(sender As Object, e As BeforeContextMenuEventArgs)
'Register a user command
' FIX: Commented out all of the following, to remove the Menu items.
'Dim nHomeCommand As Integer = CommandIds.RegisterUserCommand("Home")
'e.Menu.Items.Clear()
'e.Menu.Items.Add(New EO.WebBrowser.MenuItem("Essential Objects Homepage", nHomeCommand))
'e.Menu.Items.Add(EO.WebBrowser.MenuItem.CreateSeparator())
'e.Menu.Items.Add(New EO.WebBrowser.MenuItem("Back", CommandIds.Back))
'e.Menu.Items.Add(New EO.WebBrowser.MenuItem("Forward", CommandIds.Forward))
'e.Menu.Items.Add(New EO.WebBrowser.MenuItem("KimTest", CommandIds.SpellCheckAddToDictionary))
End Sub
eo_support
Posted: Thursday, March 30, 2017 1:32:47 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

You will need to selectively delete menu items from the context menu instead of calling Clear() to delete everything. For example, you can do something like this:

Code: C#
for (int i = 0; i < e.Menu.Items.Count; i++)
{
    int id = e.Menu.Items[i].CommandId;

    //Break as soon as we see a spell checker related menu item
    if (id >= CommandIds.SpellCheckSuggestion0)
        break;

    //Delete other items
    e.Menu.Items.RemoveAt(i);
    i--;
}


The key is you can use various member of CommandIds to test whether the menu item is related to spell checker.

An separator would have an id of 0. Other items would have pre-defined id as well as you are already aware.

Thanks!
KimKamp
Posted: Thursday, March 30, 2017 2:56:11 PM
Rank: Advanced Member
Groups: Member

Joined: 3/13/2017
Posts: 33
My code WAS showing the Dictionary menu, and then I implemented your code suggestion.

Now, no matter what I do (commenting out your new code, or commenting out all code in this Module) the SpellChecker has stopped working. :-(

What code do I need to add the SpellChecker to my code, like I have when I right-click on a work in Mozilla?
eo_support
Posted: Thursday, March 30, 2017 4:44:26 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
In fact both should work. Or if you want to take the default menu, you can simply do NOTHING in your BeforeContextMenu handler. That will have a few default items as well as the suggestions.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.