BOOL CRollupCtrl::OnCommand(WPARAM wParam, LPARAM lParam) { //PopupMenu command ExpandAllPages if (LOWORD(wParam)==RC_IDM_EXPANDALL) ExpandAllPages(TRUE,TRUE); else if (LOWORD(wParam)==RC_IDM_COLLAPSEALL) ExpandAllPages(FALSE,TRUE); //PopupMenu command ExpandPage else if (LOWORD(wParam)>=RC_IDM_STARTPAGES && LOWORD(wParam)<RC_IDM_STARTPAGES+GetPagesCount()) { int idx = LOWORD(wParam)-RC_IDM_STARTPAGES; int id = m_PageList[idx]->id; ExpandPage(id, !IsPageExpanded(id),TRUE,TRUE ); } //Button command else if (HIWORD(wParam)==BN_CLICKED) { int idx = GetPageIdxFromButtonHWND((HWND)lParam); if (idx!=-1) { RC_PAGEINFO* pi = m_PageList[idx]; ExpandPage(pi->id, !pi->bExpanded,TRUE,TRUE); return 0; } } return CWnd::OnCommand(wParam, lParam); }
//--------------------------------------------------------------------------- // OnCommand //--------------------------------------------------------------------------- BOOL CRollupCtrl::OnCommand(WPARAM wParam, LPARAM lParam) { if (LOWORD(wParam)==RC_MID_COLLAPSEALL) { ExpandAllPages(FALSE); return TRUE; } else if (LOWORD(wParam)==RC_MID_EXPANDALL) { ExpandAllPages(TRUE); return TRUE; } else if (LOWORD(wParam)>=RC_MID_STARTPAGES && LOWORD(wParam)<RC_MID_STARTPAGES+GetPagesCount()) { int idx = LOWORD(wParam)-RC_MID_STARTPAGES; ExpandPage(idx, !IsPageExpanded(idx) ); } else if (HIWORD(wParam)==BN_CLICKED) { int idx = GetPageIdxFromButtonHWND((HWND)lParam); if (idx!=-1) { RC_PAGEINFO* pi = m_PageList[idx]; /****** add some codes to change caption ******/ CString alter; alter = (pi->cstrCaption); if(!pi->bExpanded) { alter.SetAt(0, '-'); SetPageCaption(idx, (LPCSTR)(alter.GetBuffer())); } else { alter.SetAt(0, '+'); SetPageCaption(idx, (LPCSTR)(alter.GetBuffer())); } /****** ******/ ExpandPage(idx, !pi->bExpanded); SetFocus(); return TRUE; } } return CWnd::OnCommand(wParam, lParam); }
//--------------------------------------------------------------------------- // OnCommand //--------------------------------------------------------------------------- BOOL CRollupCtrl::OnCommand(WPARAM wParam, LPARAM lParam) { if (LOWORD(wParam)==RC_MID_COLLAPSEALL) { ExpandAllPages(FALSE); return TRUE; } else if (LOWORD(wParam)==RC_MID_EXPANDALL) { ExpandAllPages(TRUE); return TRUE; } else if (LOWORD(wParam)>=RC_MID_STARTPAGES && LOWORD(wParam)<RC_MID_STARTPAGES+GetPagesCount()) { int idx = LOWORD(wParam)-RC_MID_STARTPAGES; ExpandPage(idx, !IsPageExpanded(idx) ); } else if (HIWORD(wParam)==BN_CLICKED) { int idx = GetPageIdxFromButtonHWND((HWND)lParam); if (idx!=-1) { RC_PAGEINFO* pi = m_PageList[idx]; ExpandPage(idx, !pi->bExpanded); SetFocus(); /* if( IsPageExpanded(2) == true) { CPageInsertDlg pInsertPage; pInsertPage.UpdateEditControls(); } */ return TRUE; } } return CWnd::OnCommand(wParam, lParam); }