Solved

MFC get rid of annoying chevron

Posted on 2013-11-20
5
356 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 30

Expert Comment

by:Zoppo
Comment Utility
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
Comment Utility
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 30

Accepted Solution

by:
Zoppo earned 500 total points
Comment Utility
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
Comment Utility
Thank you so much, you saved me a ton of time!
0
 
LVL 30

Expert Comment

by:Zoppo
Comment Utility
:o)

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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now