From c320531909fd7a9eb65d7c816f80d15c5e8cf70a Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Fri, 22 Sep 2000 09:35:06 +0000 Subject: [PATCH] Saved-session name box now persists over panel switches [originally from svn r610] --- windlg.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/windlg.c b/windlg.c index 41951f97..9db775f2 100644 --- a/windlg.c +++ b/windlg.c @@ -508,6 +508,8 @@ static int GeneralPanelProc (HWND hwnd, UINT msg, return 0; } +static char savedsession[2048]; + static int CALLBACK ConnectionProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { int i; @@ -515,6 +517,7 @@ static int CALLBACK ConnectionProc (HWND hwnd, UINT msg, switch (msg) { case WM_INITDIALOG: SetDlgItemText (hwnd, IDC0_HOST, cfg.host); + SetDlgItemText (hwnd, IDC0_SESSEDIT, savedsession); SetDlgItemInt (hwnd, IDC0_PORT, cfg.port, FALSE); for (i = 0; i < nsessions; i++) SendDlgItemMessage (hwnd, IDC0_SESSLIST, LB_ADDSTRING, @@ -571,9 +574,13 @@ static int CALLBACK ConnectionProc (HWND hwnd, UINT msg, cfg.warn_on_close = IsDlgButtonChecked (hwnd, IDC0_CLOSEWARN); break; case IDC0_SESSEDIT: - if (HIWORD(wParam) == EN_CHANGE) + if (HIWORD(wParam) == EN_CHANGE) { SendDlgItemMessage (hwnd, IDC0_SESSLIST, LB_SETCURSEL, (WPARAM) -1, 0); + GetDlgItemText (hwnd, IDC0_SESSEDIT, + savedsession, sizeof(savedsession)-1); + savedsession[sizeof(savedsession)-1] = '\0'; + } break; case IDC0_SESSSAVE: if (HIWORD(wParam) == BN_CLICKED || @@ -1528,6 +1535,7 @@ int do_config (void) { int ret; get_sesslist(TRUE); + savedsession[0] = '\0'; ret = DialogBox (hinst, MAKEINTRESOURCE(IDD_MAINBOX), NULL, MainDlgProc); get_sesslist(FALSE);