473,411 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

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 2645
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Andrew Durdin | last post by:
In Python, you can override the behaviour of most operators for a class, by defining __add__, __gt__, and the other special object methods. I noticed that, although there are special methods for...
3
by: Ali Eghtebas | last post by:
Hi, I have 3 questions regarding the code below: 1) Why can't I trap the KEYDOWN while I can trap KEYUP? 2) Is it correct that I use Return True within the IF-Statement? (I've already read...
9
by: James Marshall | last post by:
I'm writing a library where I want to override document.write(), but for all document objects; thus, I want to put it in the prototype. I tried Document.prototype.write= my_doc_write ; but it...
4
by: ORi | last post by:
Hi all ! There's a question I've been bothering for a while: I'm actually developing architectural frameworks for application developing and I think virtual methods, although needed because of...
17
by: Bob Weiner | last post by:
What is the purpose of hiding intead of overriding a method? I have googled the question but haven't found anything that makes any sense of it. In the code below, the only difference is that...
3
by: Amin Sobati | last post by:
Hi, I have two classes. Class2 inhertis Class1: ----------------------------- Public Class Class1 Public Overridable Sub MySub() End Sub End Class Public Class Class2
6
by: John Cobb | last post by:
MSDN and intellisense shows the Add method of Hashtable being overridable however when I use this code: Public Class RAL Inherits Hashtable Public Overrides Sub Add(ByVal Key As String, ByVal...
6
by: bryanbabula | last post by:
I have a question about overriding i was wondering if anyone could help me with, or even suggesting a better/different way. I have no idea if this can even be done or not. I was wondering if there...
10
by: r035198x | last post by:
The Object class has five non final methods namely equals, hashCode, toString, clone, and finalize. These were designed to be overridden according to specific general contracts. Other classes that...
5
by: kj | last post by:
I'm trying to subclass file, overriding the readline method. The new method definition begins with def readline(self, size=None): line = self.file.readline(size) # etc., etc. ....where the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.