0

Can anyone explain how to add dropdown arrows to CMFCToolBar toolbar buttons - like for undo/redo buttons. We had this with CToolBar by using the TBSTYLE_EX_DRAWDDARROWS style and TBN_DROPDOWN notification. This doesn't seem to work with CMFCToolBar. These dropdown arrows i believe are added to the VisualStudioDemo MFC feature pack demo but i can not figure out how.

1 Answers1

1

In the VisualStudioDemo sample, in CMainFrame::OnToolbarReset they replace the Undo button of the toolbar with a custom class called CUndoButton, like this:

m_wndToolBar.ReplaceButton(ID_EDIT_UNDO, CUndoButton(ID_EDIT_UNDO, _T("&Undo")));

CUndoButton is declared in file "UndoBar.h" of the sample project, so you can use it or change it however you like.

demoncodemonkey
  • 11,730
  • 10
  • 61
  • 103
  • That's what i was starting to think. But then if i comment out the ReplaceButton call and rebuild the application shouldn't the dropdown arrow go away? I'm finding that it does not. –  Mar 20 '09 at 01:55
  • 1
    That's because the feature pack samples store their window/toolbar settings in the registry. The same occurs for me but if I delete this registry key then the dropdown arrow goes away: HKEY_CURRENT_USER\Software\Microsoft\MFC\Samples\VisualStudioDemo – demoncodemonkey Mar 20 '09 at 08:47
  • See this question for more info about the new MFC registry storage: http://stackoverflow.com/questions/184253/converting-registry-access-to-db-calls-from-mfc-feature-pack – demoncodemonkey Mar 20 '09 at 08:55
  • No worries. By the way if you would like to accept this as your answer please tick the green tick on the left. Cheers. – demoncodemonkey Mar 20 '09 at 14:26