Posted 20 years ago
by Ajay
My custom command action is not firing for the space key. It does work ok for the enter key. I am using the latest version 3. Any suggestions ?
'Enter - This works OK
kams = Me.editor.CommandLinks.GetApplicableCommandLinks(Keys.Enter)
If Not kams Is Nothing AndAlso kams.Length > 0 Then
Me.editor.CommandLinks.Remove(kams(0))
End If
kam = New ActiproSoftware.WinUICore.Commands.CommandLink(New EnterKeyAction, _
New ActiproSoftware.WinUICore.Commands.KeyBinding(Input.ModifierKeys.None, Keys.Enter))
Me.editor.CommandLinks.Add(kam)
' SPACE - This does NOT work
kams = Me.editor.CommandLinks.GetApplicableCommandLinks(Keys.Space)
If Not kams Is Nothing AndAlso kams.Length > 0 Then
Me.editor.CommandLinks.Remove(kams(0))
End If
kam = New ActiproSoftware.WinUICore.Commands.CommandLink(New SpaceKeyAction, _
New ActiproSoftware.WinUICore.Commands.KeyBinding(Input.ModifierKeys.None, Keys.Space))
Me.editor.CommandLinks.Add(kam)
The SpaceKeyAction class is defined as follows (The execute function is not getting called when I type
in space in the editor.) :
Public Class SpaceKeyAction
Inherits ActiproSoftware.SyntaxEditor.Commands.EditCommand
Public Overloads Overrides Sub Execute(ByVal context As ActiproSoftware.SyntaxEditor.Commands.EditCommandContext)
context.View.InsertText(" ")
Dim offset As Integer = context.SyntaxEditor.SelectedView.Selection.EndOffset
....
'Enter - This works OK
kams = Me.editor.CommandLinks.GetApplicableCommandLinks(Keys.Enter)
If Not kams Is Nothing AndAlso kams.Length > 0 Then
Me.editor.CommandLinks.Remove(kams(0))
End If
kam = New ActiproSoftware.WinUICore.Commands.CommandLink(New EnterKeyAction, _
New ActiproSoftware.WinUICore.Commands.KeyBinding(Input.ModifierKeys.None, Keys.Enter))
Me.editor.CommandLinks.Add(kam)
' SPACE - This does NOT work
kams = Me.editor.CommandLinks.GetApplicableCommandLinks(Keys.Space)
If Not kams Is Nothing AndAlso kams.Length > 0 Then
Me.editor.CommandLinks.Remove(kams(0))
End If
kam = New ActiproSoftware.WinUICore.Commands.CommandLink(New SpaceKeyAction, _
New ActiproSoftware.WinUICore.Commands.KeyBinding(Input.ModifierKeys.None, Keys.Space))
Me.editor.CommandLinks.Add(kam)
The SpaceKeyAction class is defined as follows (The execute function is not getting called when I type
in space in the editor.) :
Public Class SpaceKeyAction
Inherits ActiproSoftware.SyntaxEditor.Commands.EditCommand
Public Overloads Overrides Sub Execute(ByVal context As ActiproSoftware.SyntaxEditor.Commands.EditCommandContext)
context.View.InsertText(" ")
Dim offset As Integer = context.SyntaxEditor.SelectedView.Selection.EndOffset
....