PC Review


Reply
Thread Tools Rate Thread

Can't override Tab selection.

 
 
=?Utf-8?B?RG90TmV0QkJL?=
Guest
Posts: n/a
 
      19th Mar 2005
Hi,

I am using a custom text box, where I need to override TabSelection, as I
have to generate an event and based on that event, I need to do some
processing in other class, who is listening to that event. This thing works
fine, when I am stopping in the debugger for the event, but as soon as I
remove the breakpoint from the event handler method. This doesn't work and
even the release version of the software also doesn't work.
Following is a snippet of the code :-

public class TypeTextBox : System.Windows.Forms.TextBox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public delegate void TabSelectedDelegate(object sender,EventArgs e);
public event TabSelectedDelegate TabSelected;

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
const int WM_KEYDOWN = 0x100;
const int WM_SYSKEYDOWN = 0x104;
System.EventArgs e = new EventArgs();
if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN))
{
if (keyData == Keys.Tab)
{
textcolor = Color.DarkGreen;
TabSelected(this,e);
}
}
this.TabStop = false;
keyData = Keys.None;
base.TabIndex = 0;
base.TabStop = false;
return base.ProcessCmdKey(ref msg,keyData);
}
}

}

public class PicturePlacement : System.Windows.Forms.UserControl
{

private TypeTextBox myTextBox;

private void SubscribeTabSelected(TypeTextBox localTextBox)
{
localTextBox.TabSelected +=
new TypeTextBox.TabSelectedDelegate(TabSelectDone);

}
private void TabSelectDone(object localTextBox,EventArgs e)
{

// Do something here..

}

Any idea would be appreciated.

Thanks,

-Brajesh

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Selection - Paste Selection - Delete Selection Uninvisible Microsoft Excel Programming 2 25th Oct 2007 01:31 PM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Microsoft Excel Misc 2 23rd Oct 2007 04:18 PM
Combo Box selection only shows bound column info after selection made. Coby Microsoft Excel Programming 1 18th Oct 2007 02:04 AM
VC++ 2005 Beta 2: warning C4490: 'override' : incorrect use of override specifier Adriano Coser Microsoft VC .NET 2 28th Jul 2005 01:54 PM
Override Default Button Selection behaviour ian.mcewan@atonement.net Microsoft Dot NET Framework Forms 1 18th Nov 2004 01:33 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:57 AM.