|
|
|
|
Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Offer Har
|
Jan 31, 2010 - 11:47 PM
|
Dear Support, I would like to add Undo & Redo buttons like in visual studio - with a drop list and an automatic selection on hover. Is it possible in Prof-UIS? Do you have any sample? Thanks, Ron.
|
|
Technical Support
|
Feb 1, 2010 - 4:59 AM
|
The CExtBarUndoRedoButton toolbar button implements an undo-redo button exactly like your described. It’s well integrated with the Prof-UIS customization subsystem for toolbars and menus (CExtCustomizeSite ) and with ribbon controls (CExtRibbonBar , CExtRibbonPage ). The BitmapEditor demonstrates how to use undo-redo buttons.
|
|
Offer Har
|
Feb 1, 2010 - 11:59 PM
|
Dear Support, I tried to follow the example in the bitmap editor, however I only need the undo/redo and not all the customization found there, so I narrowed it to this piece of code I added in OnCreate , but nothing happened to the button in my toolbar: CWinApp* pApp = ::AfxGetApp();
g_CmdManager->ProfileSetup(pApp->m_pszProfileName, GetSafeHwnd());
g_CmdManager->UpdateFromMenu(pApp->m_pszProfileName, IDR_MAINFRAME);
g_CmdManager->UpdateFromToolBar(pApp->m_pszProfileName, IDR_TOOLBAR_EDIT_BIG);
CExtCmdItem* pCmdItem = g_CmdManager->CmdGetPtr(pApp->m_pszProfileName, ID_EDIT_UNDO );
pCmdItem->m_nLParamUserData = (LPARAM)pCmdItem->m_nCmdID;
pCmdItem->StateSetUndoRedo();
pCmdItem->StateSetSeparatedDD(); What other minimal steps I need to take to have the undo-redo? I’m still before adding the content to the drop-down, just to see the arrow next to the button, and for it to drop the drop-down... Thanks, Ron
|
|
Technical Support
|
Feb 2, 2010 - 2:11 PM
|
The BitmapEditor sample application demonstrates the CExtImageEditWnd control features. It performs image editing and supports undo-redo. The sample app uses customizable toolbars and menus and we made the ID_EDIT_UNDO and ID_EDIT_REDO commands in toolbars and menus working like undo-redo popup list boxes. The following part of the CMainFrame::OnCreate() method just marks these commands as list boxes:
CExtCmdItem * pCmdItem =
g_CmdManager->CmdGetPtr( pApp->m_pszProfileName, ID_EDIT_UNDO );
ASSERT( pCmdItem != NULL );
pCmdItem->m_nLParamUserData = (LPARAM)pCmdItem->m_nCmdID;
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
pCmdItem->StateSetUndoRedo();
pCmdItem->StateSetSeparatedDD();
#endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
pCmdItem =
g_CmdManager->CmdGetPtr( pApp->m_pszProfileName, ID_EDIT_REDO );
ASSERT( pCmdItem != NULL );
pCmdItem->m_nLParamUserData = (LPARAM)pCmdItem->m_nCmdID;
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
pCmdItem->StateSetUndoRedo();
pCmdItem->StateSetSeparatedDD();
#endif // (!defined __EXT_MFC_NO_CUSTOMIZE)
The following virtual methods are initializing list box content, measuring popup list box size, handling the item selection and provide list box caption: CMainFrame::OnPopupListBoxInitContent()
CMainFrame::OnPopupListBoxMeasureTrackSize()
CMainFrame::OnPopupListBoxSelEndOK()
CMainFrame::OnPopupUndoRedoFormatCaption()
You should implement the same methods in your project.
|
|