Home | Products | Download | Purchase | Support 


   

TestUndo Sample

 

 

The TestUndo sample demonstrates how to add a drop down undo list box to your E-XD++ Application.

Steps:

1. Create undo list box:

m_wndToolBar.ChangeToDropUndoListPickerButton(ID_EDIT_UNDO,ID_UNDODROPARROW,&m_UndoString,BS_OWNERDRAWN|BS_DROPARROWHORZ,TRUE,FALSE);
m_wndToolBar.ChangeToDropUndoListPickerButton(ID_EDIT_REDO,ID_REDODROPARROW,&m_RedoString,BS_OWNERDRAWN|BS_DROPARROWHORZ,FALSE,FALSE);
 

2. Do undo / redo actions:


void CUndoBoxView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
	// TODO: Add your specialized code here and/or call the base class
	CFODrawView::OnUpdate(pSender,lHint,pHint);

	CMainFrame *pParent = STATIC_DOWNCAST(CMainFrame,AfxGetMainWnd());
	ASSERT_VALID(pParent);
	if(pParent->IsWindowVisible())
	{
		pParent->m_UndoString.RemoveAll();
		pParent->m_RedoString.RemoveAll();

		GetCurrentModel()->GetUndoActionText(&pParent->m_UndoString);
		GetCurrentModel()->GetRedoActionText(&pParent->m_RedoString);
	}
}

LONG CUndoBoxView::OnUndoRedoOK(UINT wParam, LONG lParam)
{
	int nTotalActions = (int)wParam;
	int nType = (int)lParam;
	AfxGetApp()->BeginWaitCursor();
	if(nType == 5000)
	{
		GetCurrentModel()->UndoMacro(nTotalActions);
	}
	else
	{
		GetCurrentModel()->RedoMacro(nTotalActions);
	}
	AfxGetApp()->EndWaitCursor();
	return 0L;
}


[ Home | Products | Download Area | Purchase | SupportContact us ]


Copyright ?1998-2007 UCanCode.Net Software, all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to webmaster@ucancode.com