We've noticed that the password field on the PostgreSQL Connection
authorAaron Spike <spikeac@mlc-wels.edu>
Tue, 27 Apr 2021 10:46:59 +0000 (19:46 +0900)
committerHiroshi Inoue <h-inoue@dream.email.ne.jp>
Sun, 23 May 2021 03:53:59 +0000 (12:53 +0900)
dialog is always focused when empty, even when other fields that appear
earlier on the dialog (and in the tab order) are empty. This is only a
minor annoyance, but it does seem like it would be contrary to the
expectation of most users.
I would propose separating the conditional to inform the user that the
password is required, but still focus the first empty field.

Aaron Spike

drvconn.c

index 7224c17fe029bc054b1f3e00a116a484008073b3..2e91169996bb9d98848e4dc7fdf8c8571c2840ed 100644 (file)
--- a/drvconn.c
+++ b/drvconn.c
@@ -390,19 +390,21 @@ dconn_FDriverConnectProc(
            {
                HWND notu = GetDlgItem(hdlg, IDC_NOTICE_USER);
 
-               SetFocus(GetDlgItem(hdlg, IDC_PASSWORD));
                SetWindowText(notu, "  Supply password       ");
                ShowWindow(notu, SW_SHOW);
                SendMessage(notu, WM_CTLCOLOR, 0, 0);
            }
-           else if (ci->database[0] == '\0')
-               ;           /* default focus */
+           if (ci->database[0] == '\0')
+               SetFocus(GetDlgItem(hdlg, IDC_DATABASE));
            else if (ci->server[0] == '\0')
                SetFocus(GetDlgItem(hdlg, IDC_SERVER));
            else if (ci->port[0] == '\0')
                SetFocus(GetDlgItem(hdlg, IDC_PORT));
            else if (ci->username[0] == '\0')
                SetFocus(GetDlgItem(hdlg, IDC_USER));
+           else if (SAFE_NAME(ci->password)[0] == '\0' &&
+                ci->password_required)
+               SetFocus(GetDlgItem(hdlg, IDC_PASSWORD));
            break;
 
        case WM_COMMAND: