Solved

MFC get rid of annoying chevron

Posted on 2013-11-20
5
373 Views
Last Modified: 2013-11-20
MFC C++ MSVS2010

How do I disable chevron in menu?
0
Comment
Question by:supportoranges
  • 3
  • 2
5 Comments
 
LVL 31

Expert Comment

by:Zoppo
ID: 39662753
Hi supportoranges,

could you please be a bit more elaborate what you mean with chevron in menu.

What kind of application do you use (Dialog, SDI, MDI)?
Do you use 'new' MFC base classes like i.e. CWinAppEx, CDialogEx, CMDIFrameWndEx?
What kind of menu do you mean (i.e. main window menu bar or popup menu)?
Could you post a screenshot?

ZOPPO
0
 
LVL 1

Author Comment

by:supportoranges
ID: 39663000
Chevron is the little arrow thingy (pls see it in the attachment).   This is an MDI doc.   I use CWinAppEx.  This is a popup menu.  Hope this helps...
chevron.png
0
 
LVL 31

Accepted Solution

by:
Zoppo earned 500 total points
ID: 39663073
Hi supportoranges,

ok, this 'chevron' indicates not all menu items are shown, only the most-recently used items are shown initially, clicking on it will show the rest.

This is a optional feature which can be turned on/off in the 'Options' tab of the customize window in the app.

If you don't want to allow the user to choose this option at all you can remove some code near the end of your CMainFrame::OnCreate which (per default) looks somehow like this:
	// enable menu personalization (most-recently used commands)
	// TODO: define your own basic commands, ensuring that each pulldown menu has at least one basic command.
	CList<UINT, UINT> lstBasicCommands;

	lstBasicCommands.AddTail(ID_FILE_NEW);
	lstBasicCommands.AddTail(ID_FILE_OPEN);
	... // more similar lines.
	lstBasicCommands.AddTail(ID_SORTING_SORTBYACCESS);
	lstBasicCommands.AddTail(ID_SORTING_GROUPBYTYPE);

	CMFCToolBar::SetBasicCommands(lstBasicCommands);

Open in new window

This will remove this optional feature completeley so the user can't re-activate it anymore.

If instead you only want to turn of the behavior initially (so when the application runs the first time) you can simply add this line even near the end of CMainFrame::OnCreate:
	m_wndMenuBar.SetRecentlyUsedMenus( FALSE );

Open in new window

Thus you don't remove the feature but initially disable it, so the user later can decide to turn it on if he wants it.

Hope that helps,

ZOPPO
0
 
LVL 1

Author Closing Comment

by:supportoranges
ID: 39663106
Thank you so much, you saved me a ton of time!
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 39663116
:o)

You're welcome - I'm glad I could help ...
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question