newntui/discovermdi/src/qatree.cpp
//---------------------------------------------------------------------------------------
// This callback will run every time the user press a key while in the QA
// tree. We are using it to catch all space keys and to use them to change
// the item status. The default behavior - incremental search - turned in 
// this case off by setting *pResult = 1;
//---------------------------------------------------------------------------------------
This callback will run every time the user press a key while in the QA
tree. We are using it to catch all space keys and to use them to change
the item status. The default behavior - incremental search - turned in
this case off by setting *pResult = 1.
This callback will run every time the user press a key while in the QA tree . We are using it to catch all space keys and to use them to change the item status . The default behavior - incremental search - turned in this case off by setting * pResult = 1 .
void CQATree::OnKeydownQatree(NMHDR* pNMHDR, LRESULT* pResult)  {
TV_KEYDOWN* pTVKeyDown = (TV_KEYDOWN*)pNMHDR;
CTreeNodeInfo* info;
CString query;
CString status;
BSTR    sysQuery;
	*pResult = 0;
    HTREEITEM item = m_Tree.GetSelectedItem();
	if(item!=NULL) {
		if(pTVKeyDown->wVKey==32) {
 	         info=(CTreeNodeInfo *)m_Tree.GetItemData(item);
			 if(info->m_RootEnabled!=FALSE) {
                  query.Format("sev_get {%s} on",info->m_NodeName);
                  sysQuery=query.AllocSysString();
                  status=DataSourceAccessSync(&sysQuery);
                  SysFreeString(sysQuery)
					  ; 
				  if(status=="1") status = "0";
			      else            status = "1";
                  query.Format("sev_set {%s} on %s",info->m_NodeName,status);
                  sysQuery=query.AllocSysString();
                  CString res = DataSourceAccessSync(&sysQuery);
                  SysFreeString(sysQuery); 
	              if(info->m_NodeType=="folder") {
	                 if(status=="1") m_Tree.SetItemImage(item,1,0);
		             else            m_Tree.SetItemImage(item,7,6);
				  }
	              if(info->m_NodeType=="query_0") {
	                 if(status=="1") m_Tree.SetItemImage(item,3,2);
		             else            m_Tree.SetItemImage(item,9,8);
				  }
	              if(info->m_NodeType=="query_1") {
	                 if(status=="1") m_Tree.SetItemImage(item,5,4);
		             else            m_Tree.SetItemImage(item,9,8);
				  }
				  HTREEITEM child=m_Tree.GetChildItem(item);
				  if(child!=NULL) PropagateStatus(child,status=="1");
                  CQAParams* view;
                  view=(CQAParams* )(((CSplitterWnd *)GetParent())->GetPane(0,1));
                  view->FillPropertiesOfNode(info->m_NodeName);
	             *pResult = 1;
			 }
		}
	}
}
void CQATree :: OnKeydownQatree ( NMHDR * pNMHDR , LRESULT * pResult ) { TV_KEYDOWN * pTVKeyDown = ( TV_KEYDOWN * ) pNMHDR ; CTreeNodeInfo * info ; CString query ; CString status ; BSTR sysQuery ; * pResult = 0 ; HTREEITEM item = m_Tree . GetSelectedItem ( ) ; if ( item != NULL ) { if ( pTVKeyDown -> wVKey == 32 ) { info = ( CTreeNodeInfo * ) m_Tree . GetItemData ( item ) ; if ( info -> m_RootEnabled != FALSE ) { query . Format ( " " , info -> m_NodeName ) ; sysQuery = query . AllocSysString ( ) ; status = DataSourceAccessSync ( & sysQuery ) ; SysFreeString ( sysQuery ) ; if ( status == " " ) status = " " ; else status = " " ; query . Format ( " " , info -> m_NodeName , status ) ; sysQuery = query . AllocSysString ( ) ; CString res = DataSourceAccessSync ( & sysQuery ) ; SysFreeString ( sysQuery ) ; if ( info -> m_NodeType == " " ) { if ( status == " " ) m_Tree . SetItemImage ( item , 1 , 0 ) ; else m_Tree . SetItemImage ( item , 7 , 6 ) ; } if ( info -> m_NodeType == " " ) { if ( status == " " ) m_Tree . SetItemImage ( item , 3 , 2 ) ; else m_Tree . SetItemImage ( item , 9 , 8 ) ; } if ( info -> m_NodeType == " " ) { if ( status == " " ) m_Tree . SetItemImage ( item , 5 , 4 ) ; else m_Tree . SetItemImage ( item , 9 , 8 ) ; } HTREEITEM child = m_Tree . GetChildItem ( item ) ; if ( child != NULL ) PropagateStatus ( child , status == " " ) ; CQAParams * view ; view = ( CQAParams * ) ( ( ( CSplitterWnd * ) GetParent ( ) ) -> GetPane ( 0 , 1 ) ) ; view -> FillPropertiesOfNode ( info -> m_NodeName ) ; * pResult = 1 ; } } } }
This callback will run every time the user press a key while in the QA
tree.
This callback will run every time the user press a key while in the QA tree .
// Getting the node status // Switching the status // Setting the node status // Setting the new status according to the parent status and  // the current node status.