?
Solved

MFC get rid of annoying chevron

Posted on 2013-11-20
5
Medium Priority
?
396 Views
Last Modified: 2013-11-20
MFC C++ MSVS2010

How do I disable chevron in menu?
0
Comment
Question by:supportoranges
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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 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.

800 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