468,491 Members | 1,991 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,491 developers. It's quick & easy.

Overriding method

Hi,

I have such problem:
On my form I have TabControl. I want to move from one tab to another
using "Next" and "Prev" button. This part works fine.

But control also supports switching between TabPagess using
combination of buttons Ctrl+Tab (forward) and Ctrl+Shift+Tab (back). I
would like to suppress such possibility.

The first think that I tried - set "TabStop" to False.

Also at the article "Control.KeyDown Event " I found such text:
"To handle keyboard events only at the form level and not allow other
controls to receive keyboard events, set the KeyPressEventArgs.Handled
property in your form's KeyPress event-handling method to true.
Certain keys, such as the TAB, RETURN, ESCAPE, and arrow keys are
handled by controls automatically. In order to have these keys raise
the KeyDown event, you must override the IsInputKey method in each
control on your form. The code for the override of the IsInputKey
would need to determine if one of the special keys is pressed and
return a value of true. "

The problem is that I can not find place where (how) I have to
overriding the IsInputKey method. Or is it wrong way?

Maybe somebody has an another idea how fix such problem.

Thanks
Nov 20 '05 #1
6 2416
Try this:

Public Class Test
Inherits System.Windows.Forms.TabControl

Public Sub New()
MyBase.New()
End Sub
Protected Overrides Function IsInputKey(ByVal keyData As
System.Windows.Forms.Keys) As Boolean
If keyData = keyData.Tab Or keyData = 131089 Or keyData = 65552 Then
Return True
End If
Return False
End Function
End Class

Hi,

I have such problem:
On my form I have TabControl. I want to move from one tab to another
using "Next" and "Prev" button. This part works fine.

But control also supports switching between TabPagess using
combination of buttons Ctrl+Tab (forward) and Ctrl+Shift+Tab (back). I
would like to suppress such possibility.

The first think that I tried - set "TabStop" to False.

Also at the article "Control.KeyDown Event " I found such text:
"To handle keyboard events only at the form level and not allow other
controls to receive keyboard events, set the KeyPressEventArgs.Handled
property in your form's KeyPress event-handling method to true.
Certain keys, such as the TAB, RETURN, ESCAPE, and arrow keys are
handled by controls automatically. In order to have these keys raise
the KeyDown event, you must override the IsInputKey method in each
control on your form. The code for the override of the IsInputKey
would need to determine if one of the special keys is pressed and
return a value of true. "

The problem is that I can not find place where (how) I have to
overriding the IsInputKey method. Or is it wrong way?

Maybe somebody has an another idea how fix such problem.

Thanks

Nov 20 '05 #2
Try this:

Public Class Test
Inherits System.Windows.Forms.TabControl

Public Sub New()
MyBase.New()
End Sub
Protected Overrides Function IsInputKey(ByVal keyData As
System.Windows.Forms.Keys) As Boolean
If keyData = keyData.Tab Or keyData = 131089 Or keyData = 65552 Then
Return True
End If
Return False
End Function
End Class

Hi,

I have such problem:
On my form I have TabControl. I want to move from one tab to another
using "Next" and "Prev" button. This part works fine.

But control also supports switching between TabPagess using
combination of buttons Ctrl+Tab (forward) and Ctrl+Shift+Tab (back). I
would like to suppress such possibility.

The first think that I tried - set "TabStop" to False.

Also at the article "Control.KeyDown Event " I found such text:
"To handle keyboard events only at the form level and not allow other
controls to receive keyboard events, set the KeyPressEventArgs.Handled
property in your form's KeyPress event-handling method to true.
Certain keys, such as the TAB, RETURN, ESCAPE, and arrow keys are
handled by controls automatically. In order to have these keys raise
the KeyDown event, you must override the IsInputKey method in each
control on your form. The code for the override of the IsInputKey
would need to determine if one of the special keys is pressed and
return a value of true. "

The problem is that I can not find place where (how) I have to
overriding the IsInputKey method. Or is it wrong way?

Maybe somebody has an another idea how fix such problem.

Thanks

Nov 20 '05 #3
Ok, and after Class Test would be created - how to use it in the program?
The program know only about instance of class TabControl when I put it on
the form .

Thanks,
P.S. Maybe override method is not the best desidion. Do you know another way
not to send events to the controls.
"yEaH rIgHt" <no******@haha.com> wrote in message
news:10*************@corp.supernews.com...
Try this:

Public Class Test
Inherits System.Windows.Forms.TabControl

Public Sub New()
MyBase.New()
End Sub
Protected Overrides Function IsInputKey(ByVal keyData As
System.Windows.Forms.Keys) As Boolean
If keyData = keyData.Tab Or keyData = 131089 Or keyData = 65552 Then
Return True
End If
Return False
End Function
End Class

Hi,

I have such problem:
On my form I have TabControl. I want to move from one tab to another
using "Next" and "Prev" button. This part works fine.

But control also supports switching between TabPagess using
combination of buttons Ctrl+Tab (forward) and Ctrl+Shift+Tab (back). I
would like to suppress such possibility.

The first think that I tried - set "TabStop" to False.

Also at the article "Control.KeyDown Event " I found such text:
"To handle keyboard events only at the form level and not allow other
controls to receive keyboard events, set the KeyPressEventArgs.Handled
property in your form's KeyPress event-handling method to true.
Certain keys, such as the TAB, RETURN, ESCAPE, and arrow keys are
handled by controls automatically. In order to have these keys raise
the KeyDown event, you must override the IsInputKey method in each
control on your form. The code for the override of the IsInputKey
would need to determine if one of the special keys is pressed and
return a value of true. "

The problem is that I can not find place where (how) I have to
overriding the IsInputKey method. Or is it wrong way?

Maybe somebody has an another idea how fix such problem.

Thanks

Nov 20 '05 #4
Ok, and after Class Test would be created - how to use it in the program?
The program know only about instance of class TabControl when I put it on
the form .

Thanks,
P.S. Maybe override method is not the best desidion. Do you know another way
not to send events to the controls.
"yEaH rIgHt" <no******@haha.com> wrote in message
news:10*************@corp.supernews.com...
Try this:

Public Class Test
Inherits System.Windows.Forms.TabControl

Public Sub New()
MyBase.New()
End Sub
Protected Overrides Function IsInputKey(ByVal keyData As
System.Windows.Forms.Keys) As Boolean
If keyData = keyData.Tab Or keyData = 131089 Or keyData = 65552 Then
Return True
End If
Return False
End Function
End Class

Hi,

I have such problem:
On my form I have TabControl. I want to move from one tab to another
using "Next" and "Prev" button. This part works fine.

But control also supports switching between TabPagess using
combination of buttons Ctrl+Tab (forward) and Ctrl+Shift+Tab (back). I
would like to suppress such possibility.

The first think that I tried - set "TabStop" to False.

Also at the article "Control.KeyDown Event " I found such text:
"To handle keyboard events only at the form level and not allow other
controls to receive keyboard events, set the KeyPressEventArgs.Handled
property in your form's KeyPress event-handling method to true.
Certain keys, such as the TAB, RETURN, ESCAPE, and arrow keys are
handled by controls automatically. In order to have these keys raise
the KeyDown event, you must override the IsInputKey method in each
control on your form. The code for the override of the IsInputKey
would need to determine if one of the special keys is pressed and
return a value of true. "

The problem is that I can not find place where (how) I have to
overriding the IsInputKey method. Or is it wrong way?

Maybe somebody has an another idea how fix such problem.

Thanks

Nov 20 '05 #5

This is how you would use it:
Dim WithEvents t As New Test()

t.Size = New Size(250, 250)
t.Location = New Point(0, 0)
t.TabPages.Add(New TabPage("Help"))
t.TabPages.Add(New TabPage("OK"))
Me.Controls.Add(t)

Mike wrote:
Ok, and after Class Test would be created - how to use it in the program?
The program know only about instance of class TabControl when I put it on
the form .

Thanks,
P.S. Maybe override method is not the best desidion. Do you know another way
not to send events to the controls.
"yEaH rIgHt" <no******@haha.com> wrote in message
news:10*************@corp.supernews.com...
Try this:

Public Class Test
Inherits System.Windows.Forms.TabControl

Public Sub New()
MyBase.New()
End Sub
Protected Overrides Function IsInputKey(ByVal keyData As
System.Windows.Forms.Keys) As Boolean
If keyData = keyData.Tab Or keyData = 131089 Or keyData = 65552 Then
Return True
End If
Return False
End Function
End Class
Hi,

I have such problem:
On my form I have TabControl. I want to move from one tab to another
using "Next" and "Prev" button. This part works fine.

But control also supports switching between TabPagess using
combination of buttons Ctrl+Tab (forward) and Ctrl+Shift+Tab (back). I
would like to suppress such possibility.

The first think that I tried - set "TabStop" to False.

Also at the article "Control.KeyDown Event " I found such text:
"To handle keyboard events only at the form level and not allow other
controls to receive keyboard events, set the KeyPressEventArgs.Handled
property in your form's KeyPress event-handling method to true.
Certain keys, such as the TAB, RETURN, ESCAPE, and arrow keys are
handled by controls automatically. In order to have these keys raise
the KeyDown event, you must override the IsInputKey method in each
control on your form. The code for the override of the IsInputKey
would need to determine if one of the special keys is pressed and
return a value of true. "

The problem is that I can not find place where (how) I have to
overriding the IsInputKey method. Or is it wrong way?

Maybe somebody has an another idea how fix such problem.

Thanks


Nov 20 '05 #6

This is how you would use it:
Dim WithEvents t As New Test()

t.Size = New Size(250, 250)
t.Location = New Point(0, 0)
t.TabPages.Add(New TabPage("Help"))
t.TabPages.Add(New TabPage("OK"))
Me.Controls.Add(t)

Mike wrote:
Ok, and after Class Test would be created - how to use it in the program?
The program know only about instance of class TabControl when I put it on
the form .

Thanks,
P.S. Maybe override method is not the best desidion. Do you know another way
not to send events to the controls.
"yEaH rIgHt" <no******@haha.com> wrote in message
news:10*************@corp.supernews.com...
Try this:

Public Class Test
Inherits System.Windows.Forms.TabControl

Public Sub New()
MyBase.New()
End Sub
Protected Overrides Function IsInputKey(ByVal keyData As
System.Windows.Forms.Keys) As Boolean
If keyData = keyData.Tab Or keyData = 131089 Or keyData = 65552 Then
Return True
End If
Return False
End Function
End Class
Hi,

I have such problem:
On my form I have TabControl. I want to move from one tab to another
using "Next" and "Prev" button. This part works fine.

But control also supports switching between TabPagess using
combination of buttons Ctrl+Tab (forward) and Ctrl+Shift+Tab (back). I
would like to suppress such possibility.

The first think that I tried - set "TabStop" to False.

Also at the article "Control.KeyDown Event " I found such text:
"To handle keyboard events only at the form level and not allow other
controls to receive keyboard events, set the KeyPressEventArgs.Handled
property in your form's KeyPress event-handling method to true.
Certain keys, such as the TAB, RETURN, ESCAPE, and arrow keys are
handled by controls automatically. In order to have these keys raise
the KeyDown event, you must override the IsInputKey method in each
control on your form. The code for the override of the IsInputKey
would need to determine if one of the special keys is pressed and
return a value of true. "

The problem is that I can not find place where (how) I have to
overriding the IsInputKey method. Or is it wrong way?

Maybe somebody has an another idea how fix such problem.

Thanks


Nov 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Andrew Durdin | last post: by
9 posts views Thread by James Marshall | last post: by
17 posts views Thread by Bob Weiner | last post: by
3 posts views Thread by Amin Sobati | last post: by
6 posts views Thread by John Cobb | last post: by
3 posts views Thread by gieforce | last post: by
reply views Thread by theflame83 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.