How to use a Checkbox in a ribbon?

EGD Eric's Avatar, Join Date: Jun 2011
Newbie Member
Hi, I'm trying to figure out how to use a checkbox inside of a ribbon. The checkboxes I added to my ribbon in the editor get unchecked as soon as I check them, so I tried to create an event handler for my checkbox:
Code:
ON_COMMAND(IDC_VIDEO_RECORDING, &CMainFrame::OnVideoRecording)

....

void CMainFrame::OnVideoRecording()
{
	// TODO: Add your command handler code here
	m_bEnableVideo = !m_bEnableVideo;
}
Then I figure I can have a ON_UPDATE_COMMAND_UI event created for the checkbox, which would set the checkbox to m_bEnableVideo. Unfortunately, I set a breakpoint and OnVideoRecording never gets entered.

Maybe I'm on the wrong track? Maybe there's an easier way of doing checkboxes in ribbons in MFC? Any help would be appreciated, thanks, I've been having trouble finding good documentation on this subject. It seems like MFC has changed since I last used it, or maybe its just ribbons that are different, I dunno.

I set up the project with "MFC standard" for application type, and specified it to "use a ribbon", and I'm not using doc/view architecture.
0
EGD Eric's Avatar, Join Date: Jun 2011
Newbie Member
Ah, I see the problem now. I had some leftover handler declared in my CChildView class that was grabbing it.
0
EGD Eric's Avatar, Join Date: Jun 2011
Newbie Member
BTW, does anyone know a better way of doing it than I'm using?