Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Quick pressing of alt+tab key triggers the next tab stop in c#

$
0
0
I have overridden ProcessCmdKey in a form having this code:
if (keyData == Keys.Tab)
{                
    return true;
}
return base.ProcessCmdKey(ref msg, keyData);

In listview_KeyUp:
if (e.KeyCode == Keys.Tab && !e.Alt)
{
    treeview.Focus();
}

In treeview_KeyUp:
if (e.KeyCode == Keys.Tab && !e.Alt)
{
    listview.Focus();
}

Now, the focus is on listview,
when the application is inactive/minimized,
and alt+tab key is pressed quickly,
the application is now active but the focus
is now at treeview.

It seems when I pressed alt+tab quickly, I released tab last
and based on the code it should focus treeview.
But I don't want this behavior.

I tried the procedure with windows explorer.
It didn't switch to the next tabstop
I want this behavior.

How do I program it like windows explorer?

Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>