Groups | Blog | Home
all groups > dotnet windows forms > july 2005 >

dotnet windows forms : TAB doesn't work for non-modal forms!



Dima67 NO[at]SPAM yahoo.com
7/7/2005 1:19:03 PM
Hi group!
please, help me with the following problem:

When I open a non-modal form from a VB6 written MMC snap-in the form works
fine. But I can't use ob TAB key to navigate through its fields. The form
just ignores it.

I found some discussion about such case and they proposed a solution for a
form that doesn't use a Tab Control. But in my case the form has a Tab
Control and the proposed solution does't work.

There is no problem with the form when it works in modal mode (i.e. if its'
opened with ShowDialog() call).

I tried the following workarounds:

1) Started the non-modal form in a new thread.

Problem found: I can use TAB to switch between all form controls untill a
checkbox get the focuse. When the focuse comes to the checkbox TAB and
Shift-TAB keys are ignored again. When I select other control with the mouse
TAB key sarts to work again until the checkbox gets the focus again.

2) I added a hook using SetWindowsHookEx call to intercept all messages from
the main message loop and process them accordingly (See
http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework.windowsforms/2004-05/0112.html)

Problem found:
a) TAB order in the form become random.
b) TAB key selects only Tab Pages and standalone controls but doesn't
allow to select a coltrol in these Tap Pages.

Please help!

Lloyd Dupont
7/8/2005 12:00:00 AM
looks obvious to me!
that's the WndProc/Event loop the problem!

I have write 2 such function in my whole life and it was a while ago so I
cannot give you a more detailed answer..... but maybe there is a WNDCLASS (a
system unique string describing the windows) issue there?

well, I can't do more, but hope it will gives you some idea...

"Dima67@yahoo.com" <Dima67@yahoo.com@discussions.microsoft.com> wrote in
message news:AF6FF841-8C81-4CD7-A4F1-95FDB8EC4796@microsoft.com...
[quoted text, click to view]

Dima67
7/8/2005 6:34:02 AM
Hi Lloyd,
I agree that the problem is with the processing of the keyboard events.

But the question is how to fix it. Currently, I do not see a reliable way to
fix the issue.

I do not think that the problem may be with the corresponding WNDCLASS
because of the following reasons:
1) C# should take care about assigning a unique window indentifier.
2) The same windoe works fine if it is started from a .NET application.

So, the problem happens anly when the C# form is opened in non-modal mode
from a Win32 application. (In this case it's mmc.exe).

--
Best regards, Dima.


[quoted text, click to view]
AddThis Social Bookmark Button