newntui/discovermdi/src/dockablebrowser.cpp
//----------------------------------------------------------------------------
// This callback will run if command id is inside queries range.
// It will search in the menu map to find the query string with this ID.
//----------------------------------------------------------------------------
This callback will run if command id is inside queries range.
It will search in the menu map to find the query string with this ID.
This callback will run if command id is inside queries range . It will search in the menu map to find the query string with this ID .
void CDockableBrowser::OnMenuQuery(int id) {
CString query;
POSITION pos;
	pos=m_MenuMap.GetHeadPosition();
	while(pos) {
		if(m_MenuMap.GetAt(pos).m_ID==id) break;
		m_MenuMap.GetNext(pos);
    }
	if(pos) {
	   CCategoriesCombo* Category = (CCategoriesCombo *) GetDlgItem(IDC_CATEGORIES);
	   Category->Unselect();
	   query="{";
	   query+=m_MenuMap.GetAt(pos).m_Query;
	   query+="}";
       FormQueryRequest(query);
	   CQueryResults* Results  = (CQueryResults *) GetDlgItem(IDC_RESULTS);
	   Results->SetQuery(m_QueryRequest);
	   Results->Update();
       CString sizeStr = ExecuteCommand(CString("size $DiscoverSelection"));
       CMainFrame* main=(CMainFrame*) AfxGetMainWnd();
       main->m_SelectionSize=atoi(sizeStr);
       DisplayInfoString();
       SaveHistory();
	}
}
void CDockableBrowser :: OnMenuQuery ( int id ) { CString query ; POSITION pos ; pos = m_MenuMap . GetHeadPosition ( ) ; while ( pos ) { if ( m_MenuMap . GetAt ( pos ) . m_ID == id ) break ; m_MenuMap . GetNext ( pos ) ; } if ( pos ) { CCategoriesCombo * Category = ( CCategoriesCombo * ) GetDlgItem ( IDC_CATEGORIES ) ; Category -> Unselect ( ) ; query = " " ; query += m_MenuMap . GetAt ( pos ) . m_Query ; query += " " ; FormQueryRequest ( query ) ; CQueryResults * Results = ( CQueryResults * ) GetDlgItem ( IDC_RESULTS ) ; Results -> SetQuery ( m_QueryRequest ) ; Results -> Update ( ) ; CString sizeStr = ExecuteCommand ( CString ( " " ) ) ; CMainFrame * main = ( CMainFrame * ) AfxGetMainWnd ( ) ; main -> m_SelectionSize = atoi ( sizeStr ) ; DisplayInfoString ( ) ; SaveHistory ( ) ; } }
This callback will run if command id is inside queries range.
This callback will run if command id is inside queries range .
// Searching for the query in the menu map // if in the menu map