Windows Develop Bookmark and Share   
 index > Windows Forms General > Tab key and keyboard navigation not working in modeless forms
 

Tab key and keyboard navigation not working in modeless forms

Hi,

I've got a dialog box implemented as a Windows Form under .NET 2.0, in C#.  If I open the dialog with myForm.ShowDialog(), everything works great.  But, I need the form to be non-modal, so that my users can continue to interact with the main app while the dialog is open.  So instead, I open it with myForm.Show(), or myForm.Show(parentWin), and in both of those cases, I lose the TAB key, it no longer moves focus around the dialog.

I've seen some talk of non-Forms windows using IsDialogMessage() to process the Tab key and other dialog-specific messages.  But I can't find the equivalent thing to do in Windows Forms.  Any advice?  Thanks!
emackey  Friday, October 02, 2009 3:59 PM
This will happen when some other message loop is dispatching messages.  A common problem if you use Windows Forms in a 3rd party program.  There's no fix for this, only when Windows Forms pumps the message loop (Application.Run() or Form.ShowDialog()) will keyboard shortcuts and tabbing work properly.  Review this MSDN article for a possible workaround.

Hans Passant.
  • Marked As Answer byemackey Friday, October 02, 2009 6:26 PM
  •  
nobugz  Friday, October 02, 2009 4:31 PM
This will happen when some other message loop is dispatching messages.  A common problem if you use Windows Forms in a 3rd party program.  There's no fix for this, only when Windows Forms pumps the message loop (Application.Run() or Form.ShowDialog()) will keyboard shortcuts and tabbing work properly.  Review this MSDN article for a possible workaround.

Hans Passant.
  • Marked As Answer byemackey Friday, October 02, 2009 6:26 PM
  •  
nobugz  Friday, October 02, 2009 4:31 PM

You can use google to search for other answers

Custom Search

More Threads

• General question: how do we search on the various dotnet languages here?
• How to Make Solution Explorer More Maneageble
• drawing themed listview border
• How can i create a setup
• how to use an hscroll bar control
• Why doesn't this event fire?
• Showing a component outside it's area
• Multiple icons on listview
• C# 3.0 - ResGen.exe to convert text files to resources file from code
• Using the CR Viewer for WinApp, scrollwheel issue