From 1be16f1566b862629878a2d1a46063afeae78c38 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 3 Mar 2017 18:08:16 +0300 Subject: fix for the shitty idea of all pre-created button objects' manual initialization --- src/mir_app/src/srmm_toolbar.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/mir_app') diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp index 26523fbe01..b94c175ef0 100644 --- a/src/mir_app/src/srmm_toolbar.cpp +++ b/src/mir_app/src/srmm_toolbar.cpp @@ -320,6 +320,8 @@ MIR_APP_DLL(void) Srmm_CreateToolbarIcons(HWND hwndDlg, int flags) { HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hwndDlg, GWLP_HINSTANCE); + CDlgBase *pDlg = CDlgBase::Find(hwndDlg); + for (int i = 0; i < arButtonsList.getCount(); i++) { CustomButtonData *cbd = arButtonsList[i]; if (cbd->m_bSeparator) @@ -331,6 +333,13 @@ MIR_APP_DLL(void) Srmm_CreateToolbarIcons(HWND hwndDlg, int flags) hwndButton = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, cbd->m_iButtonWidth, DPISCALEX_S(22), hwndDlg, (HMENU)cbd->m_dwButtonCID, hInstance, NULL); if (hwndButton == NULL) // smth went wrong continue; + + // if there's a pre-created button control in a class, initialize it + if (pDlg != nullptr) { + CCtrlBase *pControl = (*pDlg)[cbd->m_dwButtonCID]; + if (pControl) + pControl->OnInit(); + } } SendMessage(hwndButton, BUTTONSETASFLATBTN, TRUE, 0); if (cbd->m_pwszText) -- cgit v1.2.3