Example #1
0
BOOL CGrammarTopicOrderDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_pTree=&m_ctrltreeTopics;
	m_strTopics=m_pDoc->GetGrammarTopicsWithIDs();
	LoadTopics();
	//the following items are for drag and drop
	int i;
	BOOL b;
	CBitmap bm;
	CBitmap* pbm;
	pbm=&bm;
	if (m_ImageList.GetSafeHandle()==NULL)   //if first time this modeless dialog initialized
	{
		m_ImageList.Create(12,12,0,0,2);  //create an imagelist for the tree control
		b=pbm->LoadBitmap(IDB_BITMAP1);
		i=m_ImageList.Add(pbm,pbm);
		i=m_ImageList.Add(pbm,pbm);    
	}
	m_pTree->SetImageList(&m_ImageList,TVSIL_NORMAL);
	m_bDragging=FALSE;
	hDropTarget=NULL;

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Example #2
0
void CGrammarTopicOrderDlg::OnLButtonUp(UINT nFlags, CPoint point) 
{
	int i,j,k,nMovedItemsIndex,nDestinationItemsIndex;
	CString Q,R,S,T,strMovedItem,strDestinationItem;
	CWnd* pWnd;

	if (m_bDragging)
	{
	    m_pDragImage->EndDrag(); 
		KillTimer(1);              //kill scroll timer if it's running
		delete m_pDragImage;
		ReleaseCapture(); 
		ShowCursor(TRUE); 
		m_bDragging=FALSE;
		if (hDropTarget!=NULL)
		{
			pWnd=&m_ctrltreeTopics;
			pWnd->RedrawWindow();  //erase the previously drawn drag image
			nMovedItemsIndex=(int)m_pTree->GetItemData(m_hSelected);    //retrieve the index of the item being moved
			strMovedItem=m_pTree->GetItemText(m_hSelected);
			nDestinationItemsIndex=(int)m_pTree->GetItemData(hDropTarget);   //retrieve the index of the destination
			strDestinationItem=m_pTree->GetItemText(hDropTarget);
			T=m_strTopics;
			strMovedItem=L"|"+strMovedItem+L"/";
			strDestinationItem=L"|"+strDestinationItem+L"/";
			T=L"|"+T;
			i=T.Find(strMovedItem);
			j=T.Find(strDestinationItem);
			if (i>-1 && j>-1)
			{
				S=T.Left(i+1);    //get the items preceding the moved item, include |
				T=T.Mid(i+1);
				k=T.Find(L"/");
				T=T.Mid(k+1);   //remove the label for the topic being moved
				k=T.Find(L"|");
				strMovedItem+=T.Left(k+1);
				T=T.Mid(k+1);     //remove the index of the moved item
				T=S+T;
				k=T.Find(strDestinationItem);
				if (i<j)        //if moving down the tree
				{
					k=T.Find(L"|",k+1);   //find the end of this item
				}
				strMovedItem=strMovedItem.Mid(1);   //remove leading |
				T=T.Left(k+1)+strMovedItem+T.Mid(k+1);   //insert moved item before destination item
				T=T.Mid(1);          //remove leading |
				m_strTopics=T;
				LoadTopics();
			}
		}
	}
	CDialog::OnLButtonUp(nFlags, point);
}
Example #3
0
void TopicLinkDlg::Group()
{
	topic.Clear();
	if(package.IsCursor() && group.IsCursor())
		LoadTopics(topic, PackageGroup(group.GetCurrentName()));
}
SwarmopediaTopics::SwarmopediaTopics()
{
	m_pKeys = NULL;
	LoadTopics();
}