summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-05-01 20:27:49 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-05-01 20:27:49 +0300
commit31b227b664aff40b7e48e17506ae34c6a24e88fd (patch)
tree7f49a60b6d7e79c9573441e67c41f92e6a17ad9d
parent9b7e17fc68e9e641a43b220375338bc2cebeed5f (diff)
more accurate tab selection
-rw-r--r--src/mir_app/src/options.cpp16
1 files changed, 8 insertions, 8 deletions
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++;
}