[PATCH] conhost: Set focus to correct radio button in save dialog
Signed-off-by: Hugh McMaster <hugh.mcmaster(a)outlook.com> --- Reversing the radio button order could be more logical. programs/conhost/window.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/programs/conhost/window.c b/programs/conhost/window.c index 48cd9ed6f6b..ad707531bd2 100644 --- a/programs/conhost/window.c +++ b/programs/conhost/window.c @@ -1819,7 +1819,8 @@ static INT_PTR WINAPI save_dialog_proc( HWND dialog, UINT msg, WPARAM wparam, LP { case WM_INITDIALOG: SendDlgItemMessageW( dialog, IDC_SAV_SESSION, BM_SETCHECK, BST_CHECKED, 0 ); - break; + SetFocus( GetDlgItem( dialog, IDC_SAV_SESSION ) ); + return FALSE; case WM_COMMAND: switch (LOWORD(wparam)) -- 2.33.0
Hi Hugh, On 8/30/21 2:04 PM, Hugh McMaster wrote:
diff --git a/programs/conhost/window.c b/programs/conhost/window.c index 48cd9ed6f6b..ad707531bd2 100644 --- a/programs/conhost/window.c +++ b/programs/conhost/window.c @@ -1819,7 +1819,8 @@ static INT_PTR WINAPI save_dialog_proc( HWND dialog, UINT msg, WPARAM wparam, LP { case WM_INITDIALOG: SendDlgItemMessageW( dialog, IDC_SAV_SESSION, BM_SETCHECK, BST_CHECKED, 0 ); - break; + SetFocus( GetDlgItem( dialog, IDC_SAV_SESSION ) );
I think that SetFocus should not be used directly on dialogs, this should probably use WM_NEXTDLGCTL instead. Thanks, Jacek
Hi Jacek, On Tue, 31 Aug 2021 at 01:39, Jacek Caban wrote:
Hi Hugh,
On 8/30/21 2:04 PM, Hugh McMaster wrote:
diff --git a/programs/conhost/window.c b/programs/conhost/window.c index 48cd9ed6f6b..ad707531bd2 100644 --- a/programs/conhost/window.c +++ b/programs/conhost/window.c @@ -1819,7 +1819,8 @@ static INT_PTR WINAPI save_dialog_proc( HWND dialog, UINT msg, WPARAM wparam, LP { case WM_INITDIALOG: SendDlgItemMessageW( dialog, IDC_SAV_SESSION, BM_SETCHECK, BST_CHECKED, 0 ); - break; + SetFocus( GetDlgItem( dialog, IDC_SAV_SESSION ) );
I think that SetFocus should not be used directly on dialogs, this should probably use WM_NEXTDLGCTL instead.
[1] says SetFocus() can be used: “If the control receiving the default focus is not appropriate, it can set the focus to the appropriate control by using the SetFocus <https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setfocus> function.” In saying that, I’ll test WM_NEXTDLGCTL to compare. [1] https://docs.microsoft.com/en-us/windows/win32/dlgbox/dlgbox-programming-con...
participants (2)
-
Hugh McMaster -
Jacek Caban