From 6cad2f47bbebb0762ccb78ad77e84bd0fdc51502 Mon Sep 17 00:00:00 2001 From: Aaron Spike Date: Tue, 27 Apr 2021 19:46:59 +0900 Subject: [PATCH] We've noticed that the password field on the PostgreSQL Connection 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 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drvconn.c b/drvconn.c index 7224c17..2e91169 100644 --- 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: -- 2.39.5