Solved

MFC get rid of annoying chevron

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Focus not getting shifted out of  editbox 2 57
how to convert c++ code to Android App 3 83
PDF library for Delphi 2 105
Template syntax for variable length arrays 9 71
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
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…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

920 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

17 Experts available now in Live!

Get 1:1 Help Now