Knowledgebase Home Page  >  RapidSpell Desktop .NET  >  Appearance Customization
Search the Knowledge Base
How do I use RapidSpellAsYouType and Thesaurus context menus together?
https://keyoti.com/kb/Default.aspx?ToDo=view&questId=69&catId=63

Options

Print this page
Email this to a friend
1. Set ShowSuggestionsContextMenu to false in RapidSpellAsYouType

2. Add a context menu to the text box

3. Create a MenuItem in the context menu called SynonymsMenuItem, and make it's Text
"Synonyms"

4. Add the following event handler to the form

Private Sub cm_popup(ByVal sender As Object, ByVal e As System.EventArgs) Handles
ContextMenu1.Popup

Dim spellingSuggestions = Me.RapidSpellAsYouType1.GetSuggestions()

Me.ContextMenu1.MenuItems.Clear()

'If there are spelling suggestions, show them

If Not spellingSuggestions Is Nothing Then

Me.ContextMenu1.MenuItems.AddRange(spellingSuggestions)

Else

'Show thesaurus sub menu

Me.ContextMenu1.MenuItems.Add(Me.SynonymsMenuItem)

Dim suggestions As MenuItem() = Me.Thesaurus1.GetSuggestionMenuItems()

Dim noSuggestionsMenuItem As New MenuItem("(No suggestions)")

noSuggestionsMenuItem.Enabled = False

Me.SynonymsMenuItem.MenuItems.Clear()

If Not (suggestions Is Nothing) Then

Me.SynonymsMenuItem.MenuItems.AddRange(suggestions)

Else

Me.SynonymsMenuItem.MenuItems.Add(noSuggestionsMenuItem)

End If

End If



End Sub 'cm_popup

This code assumes that; your ContextMenu is called "ContextMenu1", your synonyms
menu item is called "SynonymsMenuItem", your RapidSpellAsYouType is called
"RapidSpellAsYouType1" and your Thesaurus is called "Thesaurus1"

This will show the spelling suggestions menu when right clicking on a misspelt word,
and the thesaurus submenu when not.  You can of course customize this as you wish,
to include your own items, however you will need to re-add them to ContextMenu1
everytime the method is called.

Related Questions:

Attachments:

No attachments were found.