We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Double Tab Keypress in User Control

Thread ID:

Created:

Platform:

Replies:

9483 Dec 19,2003 10:58 AM Windows Forms 0
loading
Tags: FAQ
Bryan Cool
Asked On December 19, 2003 10:58 AM

I have a custom NumericUpDown I''ve built out of a textbox and a panel; the panel contains two buttons and the whole control has an imagelist. Everything is fine if I insert this control directly onto a form. However... If I put this control(call it NUD) onto another user control(call it UC1) (UC1 implements an interface), weirdness happens: The first time I set focus to a UC1 in a form, it requires me to press the tab key twice to tab to the next control. Any time after that (or if the initial focus was set by tabbing from another control into UC1), it only takes a single tab to tab to the next control on the form. The only tabbable part of UC1 is the textbox (all others have TabStop set to false). I used Spy++ on the textbox and those times it takes two tabs to get to the next control, it looks like the textbox is sending a WM_KILLFOCUS that sets the main control window of UC1 to have the focus, and then that main window is immediately setting the focus back to the textbox (textbox receives a WM_SETFOCUS). All other times the messages look right, with the textbox sending a WM_KILLFOCUS that sets focus to the next control on the form. Apparently, there can be a problem with having a panel on a user control (they inherit from different classes so their input handling is different: http://support.microsoft.com/default.aspx?scid=kb;en-us;820628); though that problem is a little different, I can''t help but wonder if they''re related. Does anyone have any ideas on what''s happening here?

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;