Professional UI Solutions
Site Map   /  Register
 
 

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.

Forums » Prof-UIS General Discussion » CExtBarButton with custom menu and undo/redo buttons Collapse All
Subject Author Date
Thomas Zaenker Jun 30, 2005 - 7:57 AM

Dear support team,


is it possible to have custom icons in a CExtPopupMenuWnd attached to a CExtBarButton and no text. Those icons will have a different size then the normal icons within the CExtCmdManger. We prefer a more "toolbar in palette mode’ look for the button menu. Is there a solution with Prof-UIS for our ideas?


Is there any sample code that uses undo/redo buttons? Is it possible to have two undo/redo buttons with different icons on it? We have two independent action groups - one for the document an one for the camera. 



Thanks in advance.



Best regards.


Axel

Technical Support Jun 30, 2005 - 12:58 PM

It is possible to code any kind of custom pop-up menu with a palette of icons. This menu can be based either on one CExtPopupMenuWnd-derived class with re-computed layout of its items with or without reference to command descriptions in the command manager. It is also possible to code a pop-up menu that contains another window that fits all the client area of the pop-up menu like a list-box menu or a date-picker menu. In your case it is possible to place a palette toolbar into the menu. We can help you but we need to discuss some details. It would be convenient to receive some screenshot of an existing solution which meets your requirements. In any case you will not have to wait long.
As for Undo/Redo pop-up menus: yes, we have a BitmapEditor sample which demonstrates how to use these menus to implement undo/redo actions for the CExtImageEditWnd window. It is possible to use any number of Undo/Redo buttons inside a frame window. Each button should have its own unique identifier to let your code determine Undo/Redo actions from particular Undo/Redo menus. This unique identifier is usually the command identifier of toolbar button, but you can specify another identifier (in the pCmdItem->m_nLParamUserData parameter) when you create the button.

LPCTSTR strProfileName =
      g_CmdManager->ProfileNameFromWnd( GetSafeHwnd() );
ASSERT( strProfileName != NULL );
CExtCmdItem * pCmdItem =
      g_CmdManager->CmdGetPtr( strProfileName, ID_EDIT_UNDO );
ASSERT( pCmdItem != NULL );
pCmdItem->m_nLParamUserData = (LPARAM)pCmdItem->m_nCmdID;
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
      pCmdItem->StateSetUndoRedo();
      pCmdItem->StateSetSeparatedDD();
#endif
Then override three virtual methods so that you can initialize the pop-up menu with data (OnPopupListBoxInitContent), handle selection events (OnPopupListBoxSelEndOK) and measure the pop-up menu’s width and height (OnPopupListBoxMeasureTrackSize).
virtual bool OnPopupListBoxInitContent(
      CExtBarButton * pTBB,
      CExtCustomizeCmdTreeNode * pNode,
      CListBox & wndListBox
      );
virtual bool OnPopupListBoxSelEndOK(
      CExtBarButton * pTBB,
      CExtCustomizeCmdTreeNode * pNode,
      CListBox & wndListBox
      );
virtual CSize OnPopupListBoxMeasureTrackSize(
      const CExtBarButton * pTBB,
      const CExtCustomizeCmdTreeNode * pNode
      ) const;