Exemplo n.º 1
0
void CTreePropSheet::OnPageTreeSelChanging(NMHDR *pNotifyStruct, LRESULT *plResult)
{
	*plResult = 0;
	if (m_bPageTreeSelChangedActive)
		return;
	else
		m_bPageTreeSelChangedActive = TRUE;

	NMTREEVIEW	*pTvn = reinterpret_cast<NMTREEVIEW*>(pNotifyStruct);
	int					nPage = m_pwndPageTree->GetItemData(pTvn->itemNew.hItem);
	BOOL				bResult;
	if (nPage<0 || (unsigned)nPage>=m_pwndPageTree->GetCount())
		bResult = KillActiveCurrentPage();
	else
		bResult = SetActivePage(nPage);

	if (!bResult)
		// prevent selection to change
		*plResult = TRUE;

	// Set focus to tree ctrl (I guess that's what the user expects)
	m_pwndPageTree->SetFocus();

	m_bPageTreeSelChangedActive = FALSE;

	return;
}
void CTreePropSheetBase::OnPageTreeSelChanging(NMHDR *pNotifyStruct, LRESULT *plResult)
{
  if( m_nRefillingPageTreeContent ) 
    return;

	*plResult = 0;

	NMTREEVIEW	*pTvn = reinterpret_cast<NMTREEVIEW*>(pNotifyStruct);
	int					nPage = m_pwndPageTree->GetItemData(pTvn->itemNew.hItem);
	BOOL				bResult;
  // Is the data item pointing to a valid page?
	if (nPage<0 || (unsigned)nPage>=m_pwndPageTree->GetCount())
	{
    // No, see if we are skipping empty page.
    if( IsTreeItemDisplayable( pTvn->itemNew.hItem ) ) 
    {
      // Skipping empty page, get the next valid page.
      HTREEITEM hNewItem = GetNextValidPageTreeItem( pTvn->itemNew.hItem );
      if( hNewItem )
        m_pwndPageTree->SelectItem( hNewItem );
      bResult = false;
    }
    else
    {
      // Not skipping empty pages, kill the current page so that we can display 
      // the generic message.
      bResult = KillActiveCurrentPage();
    }
  }
	else
  {
    if( IsTreeItemDisplayable( pTvn->itemNew.hItem ) )
    {
      // OK, set the new active page.
      TreePropSheet::CIncrementScope RefillingPageTreeContentGuard( m_nRefillingPageTreeContent );
      bResult = SetActivePage(nPage);
    }
    else
    {
      HTREEITEM hNewItem = GetNextValidPageTreeItem( pTvn->itemNew.hItem );
      if( hNewItem )
        m_pwndPageTree->SelectItem( hNewItem );
      bResult = false;
    }
  }

	if (!bResult)
		// prevent selection to change
		*plResult = TRUE;

	// Set focus to tree control (I guess that's what the user expects)
	m_pwndPageTree->SetFocus();

	return;
}
Exemplo n.º 3
0
void CTreePropSheet::OnPageTreeSelChanging(NMHDR *pNotifyStruct, LRESULT *plResult)
{
	*plResult = 0;
	if (m_bPageTreeSelChangedActive)
		return;
	else
		m_bPageTreeSelChangedActive = TRUE;

	NMTREEVIEW	*pTvn = reinterpret_cast<NMTREEVIEW*>(pNotifyStruct);
	int					nPage = m_pwndPageTree->GetItemData(pTvn->itemNew.hItem);
	BOOL				bResult;
	if (nPage<0 || (unsigned)nPage>=m_pwndPageTree->GetCount())
		bResult = KillActiveCurrentPage();
	else
		// MORPH START tabbed options
	{
		if (nPage == theApp.emuledlg->preferenceswnd->Webserver && theApp.emuledlg->preferenceswnd->ActivePageWebServer >= 1)
			nPage = theApp.emuledlg->preferenceswnd->ActivePageWebServer;

        //original line:
		bResult = SetActivePage(nPage);
	}
		// MORPH ENDtabbed options


	if (!bResult)
		// prevent selection to change
		*plResult = TRUE;

	// Set focus to tree ctrl (I guess that's what the user expects)
	m_pwndPageTree->SetFocus();

	m_bPageTreeSelChangedActive = FALSE;

	return;
}