mirror of
https://github.com/reactos/reactos.git
synced 2026-06-05 03:02:59 +08:00
[MSGINA] Fix default focus to dialog controls (#8337)
Fix some erroneous `SetFocus()` invocations in dialog procedures: - In `WM_INITDIALOG`, don't return `TRUE` if focus is changed to a control, otherwise any focus set by the caller would be ignored; - In other handlers, `SetFocus()` would generate an inconsistent behaviour with the dialog push-buttons, as mentioned in: https://devblogs.microsoft.com/oldnewthing/20040802-00/?p=38283
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#define IDC_STATIC (-1)
|
||||
|
||||
/* Icons */
|
||||
#define IDI_WINLOGON 4
|
||||
|
||||
|
||||
@@ -780,7 +780,7 @@ ChangePasswordDialogProc(
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CHANGEPWD_DOMAIN, CB_ADDSTRING, 0, (LPARAM)pgContext->DomainName);
|
||||
SendDlgItemMessageW(hwndDlg, IDC_CHANGEPWD_DOMAIN, CB_SETCURSEL, 0, 0);
|
||||
SetFocus(GetDlgItem(hwndDlg, IDC_CHANGEPWD_OLDPWD));
|
||||
return TRUE;
|
||||
return FALSE; // Default focus is changed.
|
||||
}
|
||||
|
||||
case WM_COMMAND:
|
||||
@@ -795,7 +795,7 @@ ChangePasswordDialogProc(
|
||||
{
|
||||
SetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_NEWPWD1, NULL);
|
||||
SetDlgItemTextW(hwndDlg, IDC_CHANGEPWD_NEWPWD2, NULL);
|
||||
SetFocus(GetDlgItem(hwndDlg, IDC_CHANGEPWD_OLDPWD));
|
||||
SendMessageW(hwndDlg, WM_NEXTDLGCTL, (WPARAM)GetDlgItem(hwndDlg, IDC_CHANGEPWD_OLDPWD), TRUE);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
@@ -1320,7 +1320,9 @@ LogonDialogProc(
|
||||
|
||||
if (pDlgData->pgContext->bAutoAdminLogon ||
|
||||
!pDlgData->pgContext->bDontDisplayLastUserName)
|
||||
{
|
||||
SetDlgItemTextW(hwndDlg, IDC_LOGON_USERNAME, pDlgData->pgContext->UserName);
|
||||
}
|
||||
|
||||
if (pDlgData->pgContext->bAutoAdminLogon)
|
||||
SetDlgItemTextW(hwndDlg, IDC_LOGON_PASSWORD, pDlgData->pgContext->Password);
|
||||
@@ -1338,7 +1340,7 @@ LogonDialogProc(
|
||||
if (pDlgData->pgContext->bAutoAdminLogon)
|
||||
PostMessage(GetDlgItem(hwndDlg, IDOK), BM_CLICK, 0, 0);
|
||||
|
||||
return TRUE;
|
||||
return FALSE; // Default focus is changed.
|
||||
}
|
||||
|
||||
case WM_PAINT:
|
||||
@@ -1589,18 +1591,18 @@ UnlockDialogProc(
|
||||
if (pDlgData == NULL)
|
||||
return FALSE;
|
||||
|
||||
DlgData_LoadBitmaps(pDlgData);
|
||||
|
||||
SetWelcomeText(hwndDlg);
|
||||
|
||||
SetLockMessage(hwndDlg, IDC_UNLOCK_MESSAGE, pDlgData->pgContext);
|
||||
|
||||
SetDlgItemTextW(hwndDlg, IDC_UNLOCK_USERNAME, pDlgData->pgContext->UserName);
|
||||
SetFocus(GetDlgItem(hwndDlg, IDC_UNLOCK_PASSWORD));
|
||||
|
||||
if (pDlgData->pgContext->bDisableCAD)
|
||||
EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), FALSE);
|
||||
|
||||
DlgData_LoadBitmaps(pDlgData);
|
||||
return TRUE;
|
||||
SetFocus(GetDlgItem(hwndDlg, IDC_UNLOCK_PASSWORD));
|
||||
return FALSE; // Default focus is changed.
|
||||
}
|
||||
|
||||
case WM_PAINT:
|
||||
|
||||
Reference in New Issue
Block a user