Skip to content

Commit cab12c6

Browse files
committed
[idd] helper: implement keyboard navigation in config window
1 parent 3ed08ba commit cab12c6

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

idd/LGIddHelper/CConfigWindow.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,26 +103,26 @@ LRESULT CConfigWindow::onCreate()
103103

104104
m_modeGroup.reset(new CGroupBox(L"Custom modes", WS_CHILD | WS_VISIBLE, m_hwnd));
105105

106-
m_modeBox.reset(new CListBox(WS_CHILD | WS_VISIBLE | WS_VSCROLL | LBS_NOTIFY, m_hwnd));
106+
m_modeBox.reset(new CListBox(WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | LBS_NOTIFY, m_hwnd));
107107
if (m_modes)
108108
updateModeList();
109109

110110
m_widthLabel.reset(new CStaticWidget(L"Width:", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd));
111111
m_heightLabel.reset(new CStaticWidget(L"Height:", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd));
112112
m_refreshLabel.reset(new CStaticWidget(L"Refresh:", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd));
113113

114-
m_modeWidth.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT | ES_NUMBER, m_hwnd));
115-
m_modeHeight.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT | ES_NUMBER, m_hwnd));
116-
m_modeRefresh.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT | ES_NUMBER, m_hwnd));
114+
m_modeWidth.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_NUMBER, m_hwnd));
115+
m_modeHeight.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_NUMBER, m_hwnd));
116+
m_modeRefresh.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_LEFT | ES_NUMBER, m_hwnd));
117117

118-
m_modeUpdate.reset(new CButton(L"Save", WS_CHILD | WS_VISIBLE, m_hwnd));
119-
m_modeDelete.reset(new CButton(L"Delete", WS_CHILD | WS_VISIBLE, m_hwnd));
118+
m_modeUpdate.reset(new CButton(L"Save", WS_CHILD | WS_VISIBLE | WS_TABSTOP, m_hwnd));
119+
m_modeDelete.reset(new CButton(L"Delete", WS_CHILD | WS_VISIBLE | WS_TABSTOP, m_hwnd));
120120
EnableWindow(*m_modeUpdate, FALSE);
121121
EnableWindow(*m_modeDelete, FALSE);
122122

123123
m_autosizeGroup.reset(new CGroupBox(L"Autosizing", WS_CHILD | WS_VISIBLE, m_hwnd));
124124
m_defRefreshLabel.reset(new CStaticWidget(L"Default refresh:", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd));
125-
m_defRefresh.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT | ES_NUMBER, m_hwnd));
125+
m_defRefresh.reset(new CEditWidget(WS_CHILD | WS_VISIBLE | ES_LEFT | ES_NUMBER | WS_TABSTOP, m_hwnd));
126126
m_defRefreshHz.reset(new CStaticWidget(L"Hz", WS_CHILD | WS_VISIBLE | SS_CENTERIMAGE, m_hwnd));
127127

128128
RECT client = { 0, 0, (LONG)(436 * m_scale), (LONG)(300 * m_scale) };

idd/LGIddHelper/CNotifyWindow.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ void CNotifyWindow::registerIcon()
143143
DEBUG_ERROR_HR(GetLastError(), "Shell_NotifyIcon(NIM_SETVERSION)");
144144
}
145145

146+
HWND CNotifyWindow::hwndDialog()
147+
{
148+
return m_config ? m_config->hwnd() : nullptr;
149+
}
150+
146151
void CNotifyWindow::close()
147152
{
148153
closeRequested = true;

idd/LGIddHelper/CNotifyWindow.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ class CNotifyWindow : public CWindow
2828
~CNotifyWindow() override;
2929
static bool registerClass();
3030

31+
HWND hwndDialog();
3132
void close();
3233
};

idd/LGIddHelper/main.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,12 @@ int WINAPI WinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _
105105
MSG msg;
106106
while (GetMessage(&msg, NULL, 0, 0) > 0)
107107
{
108-
TranslateMessage(&msg);
109-
DispatchMessage(&msg);
108+
HWND hDlg = window.hwndDialog();
109+
if (!hDlg || !IsDialogMessage(hDlg, &msg))
110+
{
111+
TranslateMessage(&msg);
112+
DispatchMessage(&msg);
113+
}
110114
}
111115

112116
(void) UnregisterWait(hWait);

0 commit comments

Comments
 (0)