Key event not woking

0
0
I write Overrides KeyDown Event of TextBox. It is not woking.
 Protected Overrides Sub OnKeyDown(e As KeyEventArgs)
MyBase.OnKeyDown(e)
        Select Case e.KeyValue
Case 13
If Me.Multiline = False AndAlso Me.ObjNext IsNot Nothing Then
If Me.ObjNext IsNot Nothing Then
Me.ObjNext.Focus()
End If
End If
Case 27
If Me.ObjBack IsNot Nothing Then
Me.ObjBack.Focus()
End If
End Select
End Sub
How to active Key event in wisej framework?
Thank you.
  • You must to post comments
0
0

It works as designed and explained here:

https://wisej.com/docs/2.0/html/Events.htm

In a web environment we have determined that it’s a waste of bandwidth and cpu time to send every single keystroke and every single pointer event to every control in every form. Therefore if your app needs those events for some controls you can simply attach the handler. Once attached you may either override and/or use the handlers.

 

if there is anything that doesn’t work please send a test case.

  • You must to post comments
0
0
My custom control.
Imports System
Imports System.ComponentModel
Imports System.Drawing
Imports Wisej.Web
Public Class vsTextBox
Inherits Wisej.Web.TextBox
#Region “Properties”
Private _ObjNext As Control
<Category(“MyProperties”), Description(“”), Browsable(True)>
Public Property ObjNext() As Control
Get
Return Me._ObjNext
End Get
Set(ByVal value As Control)
Me._ObjNext = value
End Set
End Property
Private _ObjBack As Control
<Category(“MyProperties”), Description(“”), Browsable(True)>
Public Property ObjBack() As Control
Get
Return Me._ObjBack
End Get
Set(ByVal value As Control)
Me._ObjBack = value
End Set
End Property
    Private _label1 As vsLabel
<Category(“MyProperties”), Description(“”), Browsable(True)>
Public Property Label1() As vsLabel
Get
Return _label1
End Get
Set(ByVal value As vsLabel)
_label1 = value
End Set
End Property
    Private _ObjTextPropertyName As String
<Category(“MyProperties”), Description(“”), Browsable(True)>
Public Property ObjTextPropertyName() As String
Get
Return Me._ObjTextPropertyName
End Get
Set(ByVal value As String)
Me._ObjTextPropertyName = value
End Set
End Property
    Private _IsSetTextForm As Boolean = True
<Category(“MyProperties”), Description(“”), Browsable(True)>
Public Property IsSetTextForm() As Boolean
Get
Return Me._IsSetTextForm
End Get
Set(value As Boolean)
Me._IsSetTextForm = value
End Set
End Property
#End Region
#Region “Event”
Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
MyBase.OnGotFocus(e)
        If Me.Label1 IsNot Nothing Then
Me.Label1.Font = New Font(Me.Label1.Font.Name, Me.Label1.Font.Size, FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel)
End If
End Sub
Protected Overrides Sub OnLostFocus(ByVal e As System.EventArgs)
MyBase.OnLostFocus(e)
        If Me.Label1 IsNot Nothing Then
Me.Label1.Font = New Font(Me.Label1.Font.Name, Me.Label1.Font.Size, FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
End If
End Sub
Protected Overrides Sub OnKeyDown(e As KeyEventArgs)
MyBase.OnKeyDown(e)
        Select Case e.KeyValue
Case 13
If Me.Multiline = False AndAlso Me.ObjNext IsNot Nothing Then
If Me.ObjNext IsNot Nothing Then
Me.ObjNext.Focus()
End If
End If
Case 27
If Me.ObjBack IsNot Nothing Then
Me.ObjBack.Focus()
End If
End Select
End Sub
#End Region
End Class
In winform,I don’t need to attach a handler. KeyDown event does work.
Wisej framework, KeyDown event doesn’t work.
  • You must to post comments
0
0

Hi,

did you attach a handler ?

See lazy events here

https://wisej.com/docs/2.0/html/Events.htm

Best regards
Frank

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.