Index: src/ch/StatusDlg.cpp =================================================================== diff -u -r4797e4b6b266900bfdcdf4ca6eda47c216ad9db1 -r3bc596c5916dddf4016d9cb8693c3450c86041a8 --- src/ch/StatusDlg.cpp (.../StatusDlg.cpp) (revision 4797e4b6b266900bfdcdf4ca6eda47c216ad9db1) +++ src/ch/StatusDlg.cpp (.../StatusDlg.cpp) (revision 3bc596c5916dddf4016d9cb8693c3450c86041a8) @@ -162,22 +162,48 @@ RefreshStatus(); // select needed element + SelectInitialTask(); + + // refresh data timer + SetTimer(777, GetPropValue(GetConfig()), nullptr); + + return TRUE; +} + +void CStatusDlg::SelectInitialTask() +{ size_t stIndex = 0; + bool bSelected = false; while(stIndex < m_pTasks->GetSize()) { - if(m_pTasks->GetAt(stIndex) == m_spInitialSelection) + chcore::TTaskPtr spTask = m_pTasks->GetAt(stIndex); + if(m_spInitialSelection) { - m_ctlStatusList.SetItemState(boost::numeric_cast(stIndex), LVIS_SELECTED, LVIS_SELECTED); - break; + if(spTask == m_spInitialSelection) + { + m_ctlStatusList.SetItemState(boost::numeric_cast(stIndex), LVIS_SELECTED, LVIS_SELECTED); + bSelected = true; + break; + } } + else + { + if(spTask->IsRunning()) + { + m_ctlStatusList.SetItemState(boost::numeric_cast(stIndex), LVIS_SELECTED, LVIS_SELECTED); + bSelected = true; + break; + } + } stIndex++; } - // refresh data timer - SetTimer(777, GetPropValue(GetConfig()), nullptr); - - return TRUE; + if(!bSelected) + { + stIndex = m_pTasks->GetSize() - 1; + m_ctlStatusList.SetItemState(boost::numeric_cast(stIndex), LVIS_SELECTED, LVIS_SELECTED); + } } void CStatusDlg::EnableControls(bool bEnable) Index: src/ch/StatusDlg.h =================================================================== diff -u -r8068e0c351055554340ac9755d1bc846893bf2b8 -r3bc596c5916dddf4016d9cb8693c3450c86041a8 --- src/ch/StatusDlg.h (.../StatusDlg.h) (revision 8068e0c351055554340ac9755d1bc846893bf2b8) +++ src/ch/StatusDlg.h (.../StatusDlg.h) (revision 3bc596c5916dddf4016d9cb8693c3450c86041a8) @@ -78,6 +78,9 @@ void SetWindowTitle(PCTSTR pszText); virtual BOOL OnInitDialog(); + + void SelectInitialTask(); + afx_msg void OnTimer(UINT_PTR nIDEvent); afx_msg void OnPauseButton(); afx_msg void OnCancelButton();