Knowledgebase Home Page  >  RapidSpell Desktop .NET  >  Appearance Customization
Search the Knowledge Base
With RapidSpellAsYouType, how can I use the spell checker suggestions menu items with my own context menu?
https://keyoti.com/kb/Default.aspx?ToDo=view&questId=37&catId=63

Options

Print this page
Email this to a friend
This can be acheived by setting;

Me.RapidSpellAsYouType1.ShowSuggestionsContextMenu = False

and listening to the popup event of your own context menu to dynamically add your own items;

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

ContextMenu1.MenuItems.Clear()

ContextMenu1.MenuItems.Add("Item1")

ContextMenu1.MenuItems.Add("Item2")

End Sub

and also listening to the SpellContextMenuRequest event to add your items and the RapidSpellAsYouType suggestions and other menu items;

Private Sub RapidSpellAsYouType1_SpellContextMenuRequest(ByVal sender As Object, ByVal e As Keyoti.RapidSpell.Event.SpellContextMenuEventArgs) Handles RapidSpellAsYouType1.SpellContextMenuRequest

Me.AytRichTextBox1.ContextMenu.MenuItems.Clear()

'All all suggestions items etc.

Me.AytRichTextBox1.ContextMenu.MenuItems.AddRange(DirectCast(e.MenuItems, MenuItem()))

'Add own menu items

ContextMenu1.MenuItems.Add("Item1")

ContextMenu1.MenuItems.Add("Item2")

End Sub

Because the menu items supplied in e.MenuItems are already hooked into the RapidSpellAsYouType object, no extra programming is needed.
 
 
 
VB code example

Public Class Form5

Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing Then

If Not (components Is Nothing) Then

components.Dispose()

End If

End If

MyBase.Dispose(disposing)

End Sub

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

Friend WithEvents AytRichTextBox1 As Keyoti.RapidSpell.AYTRichTextBox

Friend WithEvents RapidSpellAsYouType1 As Keyoti.RapidSpell.RapidSpellAsYouType

Friend WithEvents ContextMenu1 As System.Windows.Forms.ContextMenu

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

Me.components = New System.ComponentModel.Container

Me.AytRichTextBox1 = New Keyoti.RapidSpell.AYTRichTextBox

Me.RapidSpellAsYouType1 = New Keyoti.RapidSpell.RapidSpellAsYouType(Me.components)

Me.ContextMenu1 = New System.Windows.Forms.ContextMenu

Me.SuspendLayout()

'

'AytRichTextBox1

'

Me.AytRichTextBox1.ContextMenu = Me.ContextMenu1

Me.AytRichTextBox1.Dock = System.Windows.Forms.DockStyle.Fill

Me.AytRichTextBox1.Location = New System.Drawing.Point(0, 0)

Me.AytRichTextBox1.Name = "AytRichTextBox1"

Me.AytRichTextBox1.ShowCutCopyPasteContextMenu = False

Me.AytRichTextBox1.Size = New System.Drawing.Size(292, 271)

Me.AytRichTextBox1.TabIndex = 0

Me.AytRichTextBox1.Text = "AytRichTextBox1"

Me.AytRichTextBox1.UseUndoCompatibleTextAccess = False

'

'RapidSpellAsYouType1

'

Me.RapidSpellAsYouType1.AddMenuText = "Add"

Me.RapidSpellAsYouType1.AllowMixedCase = False

Me.RapidSpellAsYouType1.CheckAsYouType = True

Me.RapidSpellAsYouType1.CheckCompoundWords = False

Me.RapidSpellAsYouType1.ConsiderationRange = 80

Me.RapidSpellAsYouType1.DictFilePath = Nothing

Me.RapidSpellAsYouType1.GUILanguage = Keyoti.RapidSpell.LanguageType.ENGLISH

Me.RapidSpellAsYouType1.IgnoreAllMenuText = "Ignore All"

Me.RapidSpellAsYouType1.IgnoreCapitalizedWords = False

Me.RapidSpellAsYouType1.IgnoreURLsAndEmailAddresses = True

Me.RapidSpellAsYouType1.IgnoreWordsWithDigits = True

Me.RapidSpellAsYouType1.IncludeUserDictionaryInSuggestions = False

Me.RapidSpellAsYouType1.LanguageParser = Keyoti.RapidSpell.LanguageType.ENGLISH

Me.RapidSpellAsYouType1.LookIntoHyphenatedText = True

Me.RapidSpellAsYouType1.SeparateHyphenWords = False

Me.RapidSpellAsYouType1.ShowAddMenuOption = True

Me.RapidSpellAsYouType1.ShowSuggestionsContextMenu = False

Me.RapidSpellAsYouType1.SuggestionsMethod = Keyoti.RapidSpell.SuggestionsMethodType.HashingSuggestions

Me.RapidSpellAsYouType1.SuggestSplitWords = True

Me.RapidSpellAsYouType1.TextComponent = Me.AytRichTextBox1

Me.RapidSpellAsYouType1.UnderlineColor = System.Drawing.Color.Red

Me.RapidSpellAsYouType1.UnderlineStyle = Keyoti.RapidSpell.UnderlineStyle.Wavy

Me.RapidSpellAsYouType1.UserDictionaryFile = Nothing

Me.RapidSpellAsYouType1.V2Parser = True

'

'ContextMenu1

'

'

'Form5

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

Me.ClientSize = New System.Drawing.Size(292, 271)

Me.Controls.Add(Me.AytRichTextBox1)

Me.Name = "Form5"

Me.Text = "Form5"

Me.ResumeLayout(False)

End Sub

#End Region

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

ContextMenu1.MenuItems.Clear()

ContextMenu1.MenuItems.Add("Item1")

ContextMenu1.MenuItems.Add("Item2")

End Sub

Private Sub RapidSpellAsYouType1_SpellContextMenuRequest(ByVal sender As Object, ByVal e As Keyoti.RapidSpell.Event.SpellContextMenuEventArgs) Handles RapidSpellAsYouType1.SpellContextMenuRequest

Me.AytRichTextBox1.ContextMenu.MenuItems.Clear()

Me.AytRichTextBox1.ContextMenu.MenuItems.AddRange(DirectCast(e.MenuItems, MenuItem()))

ContextMenu1.MenuItems.Add("Item1")

ContextMenu1.MenuItems.Add("Item2")

End Sub

End Class


Related Questions:

Attachments:

No attachments were found.