Fixed handling of control focus.

This commit is contained in:
Thomas Weidenmueller 2004-01-16 21:20:54 +00:00 committed by Alexandre Julliard
parent 794e046279
commit 7285f46840
3 changed files with 10 additions and 3 deletions

View File

@ -126,6 +126,7 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
pChildWnd->hWnd = hWnd;
pChildWnd->hTreeWnd = CreateTreeView(hWnd, pChildWnd->szPath, TREE_WINDOW);
pChildWnd->hListWnd = CreateListView(hWnd, LIST_WINDOW/*, pChildWnd->szPath*/);
SetFocus(pChildWnd->hTreeWnd);
break;
case WM_COMMAND:
if (!_CmdWndProc(hWnd, message, wParam, lParam)) {
@ -243,12 +244,17 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
}
}
break;
case NM_SETFOCUS:
pChildWnd->nFocusPanel = 1;
break;
default:
goto def;
}
} else
if ((int)wParam == LIST_WINDOW) {
if (!SendMessage(pChildWnd->hListWnd, message, wParam, lParam)) {
if (((LPNMHDR)lParam)->code == NM_SETFOCUS) {
pChildWnd->nFocusPanel = 0;
} else if (!SendMessage(pChildWnd->hListWnd, message, wParam, lParam)) {
goto def;
}
}

View File

@ -375,7 +375,7 @@ HWND CreateListView(HWND hwndParent, int id)
/* Get the dimensions of the parent window's client area, and create the list view control. */
GetClientRect(hwndParent, &rcClient);
hwndLV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, _T("List View"),
WS_VISIBLE | WS_CHILD | LVS_REPORT | LVS_EDITLABELS,
WS_VISIBLE | WS_CHILD | WS_TABSTOP | LVS_REPORT | LVS_EDITLABELS,
0, 0, rcClient.right, rcClient.bottom,
hwndParent, (HMENU)id, hInst, NULL);
if (!hwndLV) return NULL;

View File

@ -186,7 +186,8 @@ int APIENTRY WinMain(HINSTANCE hInstance,
/* Main message loop */
while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
if (!TranslateAccelerator(msg.hwnd, hAccel, &msg)) {
if (!TranslateAccelerator(msg.hwnd, hAccel, &msg) &&
!IsDialogMessage(hFrameWnd, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}