From 31b227b664aff40b7e48e17506ae34c6a24e88fd Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 1 May 2020 20:27:49 +0300 Subject: more accurate tab selection --- src/mir_app/src/options.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index 4ce9ef73fb..59e469be6d 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -948,11 +948,15 @@ public: return; } - tvi.mask = TVIF_HANDLE | TVIF_PARAM; - m_pageTree.GetItem(&tvi); - m_currentPage = tvi.lParam; ShowWindow(GetDlgItem(m_hwnd, IDC_TAB), SW_HIDE); + // if called inside OnInitDialog, we do not update current page + if (IsInitialized()) { + tvi.mask = TVIF_HANDLE | TVIF_PARAM; + m_pageTree.GetItem(&tvi); + m_currentPage = tvi.lParam; + } + opd = getCurrent(); if (opd == nullptr) { ShowWindow(GetDlgItem(m_hwnd, IDC_STNOPAGE), SW_SHOW); @@ -964,10 +968,6 @@ public: opd->bInsideTab = IsInsideTab(m_currentPage); if (opd->bInsideTab) { - // if called inside OnInitDialog, we use tab setting passed for positioning - // or the first tab of the current tree item - auto *pwszTab = (IsInitialized()) ? opd->ptszTab : m_szTab; - // Make tabbed pane int pages = 0, sel = 0; HWND hwndTab = GetDlgItem(m_hwnd, IDC_TAB); @@ -987,7 +987,7 @@ public: tie.pszText = TranslateW_LP(p->ptszTab, p->pPlugin); tie.lParam = i; TabCtrl_InsertItem(hwndTab, pages, &tie); - if (!mir_wstrcmp(pwszTab, p->ptszTab)) + if (!mir_wstrcmp(opd->ptszTab, p->ptszTab)) sel = pages; pages++; } -- cgit v1.2.3