Skip to content

Commit 085235d

Browse files
committed
When up/down arrow keys pressed in attribute edit, select attribute in list, like the attribute value list.
1 parent a50c02b commit 085235d

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

MainWindow.ixx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ LRESULT CALLBACK AttributeValueEditProcedure(
357357
case WM_PRINTCLIENT:
358358
case WM_PAINT:
359359
{
360+
// Draw the cue banner text if no text is typed.
360361
auto textLength = GetWindowTextLength(hwnd);
361362
if (textLength == 0)// && GetFocus() != hwnd)
362363
{
@@ -402,6 +403,44 @@ LRESULT CALLBACK AttributeValueEditProcedure(
402403
}
403404

404405

406+
LRESULT CALLBACK AttributesEditProcedure(
407+
HWND hwnd,
408+
UINT message,
409+
WPARAM wParam,
410+
LPARAM lParam,
411+
UINT_PTR subclassId,
412+
DWORD_PTR data
413+
)
414+
{
415+
// Subclass procedure for the attribute value edit, so that the edit
416+
// behaves like a combo box.
417+
418+
MainWindow* window = reinterpret_cast<MainWindow*>(data);
419+
420+
switch (message)
421+
{
422+
case WM_KEYDOWN:
423+
{
424+
switch (wParam)
425+
{
426+
case VK_PRIOR:
427+
case VK_NEXT:
428+
case VK_UP:
429+
case VK_DOWN:
430+
return SendMessage(GetWindowFromId(window->GetHwnd(), IdcAttributesList), message, wParam, lParam);
431+
}
432+
}
433+
break;
434+
435+
case WM_NCDESTROY:
436+
RemoveWindowSubclass(hwnd, &AttributesEditProcedure, 0);
437+
break;
438+
}
439+
440+
return DefSubclassProc(hwnd, message, wParam, lParam);
441+
}
442+
443+
405444
INT_PTR MainWindow::InitializeMainDialog()
406445
{
407446
////////////////////
@@ -437,6 +476,7 @@ INT_PTR MainWindow::InitializeMainDialog()
437476

438477
auto attributesEdit = GetWindowFromId(hwnd_, IdcAttributesFilterEdit);
439478
Edit_SetCueBannerText(attributesEdit, L"<type attribute filter here>");
479+
SetWindowSubclass(attributesEdit, &AttributesEditProcedure, 0, reinterpret_cast<DWORD_PTR>(this));
440480

441481
ChangeSettingsVisibility(settingsVisibility_);
442482
InitializeDrawableObjectsListView();

0 commit comments

Comments
 (0)