mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[RAPPS] Allow tabbing trough controls in the main window
This commit is contained in:
parent
2eed38eb5f
commit
dee771817e
1 changed files with 33 additions and 0 deletions
|
@ -1850,6 +1850,29 @@ public:
|
|||
|
||||
return CWindowImpl::Create(NULL, r, szWindowName.GetString(), WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_WINDOWEDGE);
|
||||
}
|
||||
|
||||
void HandleTabOrder(int direction)
|
||||
{
|
||||
HWND Controls[] = { m_Toolbar->m_hWnd, m_SearchBar->m_hWnd, m_TreeView->m_hWnd, m_ListView->m_hWnd, m_RichEdit->m_hWnd };
|
||||
// When there is no control found, go to the first or last (depending on tab vs shift-tab)
|
||||
int current = direction > 0 ? 0 : (_countof(Controls) - 1);
|
||||
HWND hActive = ::GetFocus();
|
||||
for (int n = 0; n < _countof(Controls); ++n)
|
||||
{
|
||||
if (hActive == Controls[n])
|
||||
{
|
||||
current = n + direction;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (current < 0)
|
||||
current = (_countof(Controls) - 1);
|
||||
else if (current >= _countof(Controls))
|
||||
current = 0;
|
||||
|
||||
::SetFocus(Controls[current]);
|
||||
}
|
||||
};
|
||||
|
||||
VOID ShowMainWindow(INT nShowCmd)
|
||||
|
@ -1877,6 +1900,16 @@ VOID ShowMainWindow(INT nShowCmd)
|
|||
{
|
||||
if (!TranslateAcceleratorW(hMainWnd, KeyBrd, &Msg))
|
||||
{
|
||||
if (Msg.message == WM_CHAR &&
|
||||
Msg.wParam == VK_TAB)
|
||||
{
|
||||
// Move backwards if shift is held down
|
||||
int direction = (GetKeyState(VK_SHIFT) & 0x8000) ? -1 : 1;
|
||||
|
||||
wnd->HandleTabOrder(direction);
|
||||
continue;
|
||||
}
|
||||
|
||||
TranslateMessage(&Msg);
|
||||
DispatchMessageW(&Msg);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue