Click here to Skip to main content
15,886,782 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi guys, now am in a MFC project which contains rich ribbon controls.
I am using document view architecture and i inherit my view class from CListView.
In my UI design i have 6 category ribbons, i need to change my list view when category ribbons are selected.

Is there any notification is for category selection change. i dont know how to do it and also i need to do command routing from my CMainFrame to CDocView. How can achieve these two.......

If you know guide me.....

Thanks in advance
ganesh_IT
Posted

Hi,
I'm sure this is outdated question, but here's the straight answer.
Add this to you message map in MainFrm.cpp:
C++
ON_REGISTERED_MESSAGE(AFX_WM_ON_CHANGE_RIBBON_CATEGORY, OnRibbonCategoryChanged)

then, declare and implement method OnRibbonCategoryChanged:
C++
LPARAM CMainFrame::OnRibbonCategoryChanged(WPARAM wp, LPARAM lp)
{
	CMFCRibbonCategory *pCategory=m_wndRibbonBar.GetActiveCategory();
	int nCategory=m_wndRibbonBar.GetCategoryIndex(pCategory);
	//... do something
	return 0;
}


The nCategory variable holds current category index (starting with one, left to right).
 
Share this answer
 
Hi guys, i found solution for my problem. There is r registered message AFX_WM_ON_CHANGE_RIBBON_CATEGORY.

MFC Frame work send this message to the framewnd when category is changed. It LPARAM contains pointer to the CMFCRibbonBar using this we can get our active category name.

Thanks
ganeshIT
 
Share this answer
 
Thanks for your good question and answer!
I really need this information because i have been looking for this message!

Kind regards,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900