Dynamically setting menu text 
Author Message
 Dynamically setting menu text

In OnInitialUpdate() of my view I use

CString   strMenu = "&Dale";      
CMenu *pMenu = AfxGetApp()->GetMainWnd()->GetMenu();
if (pMenu != NULL) {
   pMenu->ModifyMenu(1, MF_BYPOSITION | MF_STRING, 0, strMenu);

Quote:
}

to dynamically set the menu text.  It doesn't work for the 1st document opened initially, but it does for all others.  How do i get it set for all?

-----------------** -- Posted from CodeGuru -- **-----------------
http://www.*-*-*.com/ ;  The website for Visual C++ programmers.



Fri, 26 Oct 2001 03:00:00 GMT  
 Dynamically setting menu text

Quote:

>In OnInitialUpdate() of my view I use

>CString   strMenu = "&Dale";  
>CMenu *pMenu = AfxGetApp()->GetMainWnd()->GetMenu();
>if (pMenu != NULL) {
>   pMenu->ModifyMenu(1, MF_BYPOSITION | MF_STRING, 0, strMenu);
>}
>to dynamically set the menu text.  It doesn't work for the 1st document
>opened initially, but it does for all others.  How do i get it set for all?

     Well, my first guess would be that it _is_ working for all of them, but
the changes aren't always getting reflected on the screen, because you
aren't calling DrawMenuBar.  Does this code work for you if you add
"AfxGetApp()->GetMainWnd()->DrawMenuBar();" immediately after the ModifyMenu
call?

--
\o\ If you're interested in books and stories with transformation themes, \o\
/o/ please have a look at <URL:http://www.halcyon.com/phaedrus>. Thanks!  /o/
\o\   FC1.21:FC(W/C)p6arw A- C->++ D>++ H+ M>+ P R T++++ W** Z+ Sm RLCT   \o\
/o/              a cmn++++$ d e++ f+++ h- i++wf p-- sm#                   /o/



Fri, 26 Oct 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Dynamically change menu text

2. Dynamically changing text of a menu in a Dialog box

3. URGENT! Dynamically change File menu text

4. Howto dynamically set tool tip text?

5. ? dynamically setting text in the status bar

6. ? dynamically setting text in the status bar

7. help working with context menus and adding menu items dynamically

8. How do set a exe File in Debug Tab of Project setting dynamically

9. Bold menu text for default menu selection in a popup menu

10. set text color on static text

11. Need to Set text from Dialog CEdit to Active Window in MDI text app

12. Dynamically Modifying Menu Items

 

 
Powered by phpBB® Forum Software