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
2009-03-19 22:17:08
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.
2009-03-20 01:55:48
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
2009-03-20 08:47:49
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
2009-03-20 08:55:41
So right you are. Thanks for your help.
2009-03-20 13:08:56
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
2009-03-20 14:26:05