davidgrantaustin
asked on
How to display text of pop-up menu in status bar...
Currently, I am able to pass the main menu text information to the status bar, along with the selected sub menu, but is it possible to pass the text information of a pop-up menu to the status bar. I have not been able to figure out how to accomplish this. Any code sample that you could provide would be greatly appreciated.
For example File, shows File in the status bar.
Under File, there are multiple pop-up sub menus, like Delete.
When Delete is highlighted, I can not seem to show "Delete" on the status bar. I would like to show the text "Delete Menu".
However, when ever I select one of the Delete pop-up menu's submenus (which are not pop-up windows themselves) like "Delete", "Delete Line", "Delete to Start of Line" and "Delete to End of Line", these show the text in the status bar without problem.
For example File, shows File in the status bar.
Under File, there are multiple pop-up sub menus, like Delete.
When Delete is highlighted, I can not seem to show "Delete" on the status bar. I would like to show the text "Delete Menu".
However, when ever I select one of the Delete pop-up menu's submenus (which are not pop-up windows themselves) like "Delete", "Delete Line", "Delete to Start of Line" and "Delete to End of Line", these show the text in the status bar without problem.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Do you want to see some string (for example, "COM PORT"), when popup menu COM Port is selected?
void CMainFrame::OnInitMenuPopu p(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
{
CFrameWnd::OnInitMenuPopup (pPopupMen u, nIndex, bSysMenu);
if ( pPopupMenu->GetMenuItemID( 0) == IDM_COM1 )
m_wndStatusBar.SetWindowTe xt(_T("COM PORT"));
}
void CMainFrame::OnInitMenuPopu
{
CFrameWnd::OnInitMenuPopup
if ( pPopupMenu->GetMenuItemID(
m_wndStatusBar.SetWindowTe
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
AlexFM and ZOPPO
This is the format that I am trying to follow:
Under VM_MENUSELECT
I check MFT_SEPARATOR
if Yes, then blank the character from being displayed on the Status Bar.
Check MF_POPUP
if No, then then display the current character on the Status Bar.
Check MF_SYSMENU
if Yes, then then display the current character on the Status Bar.
Rearrange the index.
This is the process that I am trying to follow. How do I display the correct sub-pop-up item on the status bar? Sorry to be so tedius on this, but I just know that there must be some way to accomplish this as I have seen this done in other MFC GUIs.
This is the format that I am trying to follow:
Under VM_MENUSELECT
I check MFT_SEPARATOR
if Yes, then blank the character from being displayed on the Status Bar.
Check MF_POPUP
if No, then then display the current character on the Status Bar.
Check MF_SYSMENU
if Yes, then then display the current character on the Status Bar.
Rearrange the index.
This is the process that I am trying to follow. How do I display the correct sub-pop-up item on the status bar? Sorry to be so tedius on this, but I just know that there must be some way to accomplish this as I have seen this done in other MFC GUIs.
ASKER
Perhaps I wasn't quite clear of what I want to accomplish.
This is what I am trying to do:
IDM_MENU MENU MOVEABLE IMPURE LOADONCALL DISCARDABLE
{
POPUP "&File"
{
MENUITEM "&New \tCtrl+N",IDM_NEW
MENUITEM "O&pen \tCtrl+O",IDM_OPEN
MENUITEM SEPARATOR
MENUITEM "&Close \tCtrl+W",IDM_CLOSE
MENUITEM SEPARATOR
MENUITEM "&Save \tCtrl+S",IDM_SAVE
MENUITEM "Save &As \tCtrl+A",IDM_SAVEAS
MENUITEM SEPARATOR
MENUITEM "E&xit \tCtrl+X",IDM_EXIT
}
POPUP "RS-232 Configuration"
{
POPUP "COM Port" <<<<<< ********** >>>>>>>>>>>>>>
{
MENUITEM "COM1", IDM_COM1 , CHECKED
MENUITEM "COM2", IDM_COM2
MENUITEM "COM3", IDM_COM3
MENUITEM "COM4", IDM_COM4
}
}
The code I am looking for goes into the <<<<<< ********** >>>>>>>>>>>>>> portion and allows the pop-up menu of "COM Port" when this pop-up menu is highlighted to be shown in the Control Status Bar.
Thanks in advance for your help!