views:

836

answers:

1

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.

A: 

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
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.
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
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
So right you are. Thanks for your help.
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