How to Assign the Work to Dynamically created Menus while using Doc View Arch 
Author Message
 How to Assign the Work to Dynamically created Menus while using Doc View Arch

Hey Friends
  I am developing a MDI Based Application in which I want
Some Menus to be added dynamically.Can someone tell how to
assign the work to these dynamically created menus.
I am using AppendMenu Function for the same.

     MFC will Disable the menus for which there is no
event handler .Now how do I click on the button.
Please Help.



Mon, 04 Apr 2005 11:38:28 GMT  
 How to Assign the Work to Dynamically created Menus while using Doc View Arch

Quote:

> Hey Friends
>   I am developing a MDI Based Application in which I want
> Some Menus to be added dynamically.Can someone tell how to
> assign the work to these dynamically created menus.
> I am using AppendMenu Function for the same.

>      MFC will Disable the menus for which there is no
> event handler .Now how do I click on the button.
> Please Help.


The menu messages must be added to your message map by hand (no
wizard).  Example:

BEGIN_MESSAGE_MAP(CSApp, CWinApp)
 //{{AFX_MSG_MAP(CSApp)
 ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
 //}}AFX_MSG_MAP
 // Add lines here...
 ON_COMMAND(ID_DYNAMIC1, OnDynamic1)
END_MESSAGE_MAP()

--
Scott McPhillips [VC++ MVP]



Tue, 05 Apr 2005 01:47:24 GMT  
 How to Assign the Work to Dynamically created Menus while using Doc View Arch
I tend to create a menu which has all the times I want, then remove the items I don't
want. That sometimes works except when you are creating truly dynamic elements based on
the data. In that case, I allocate a range for the messages, e.g., 20000-21000, and use
symbolic names and ON_COMMAND_RANGE to handle the items selected. I either use the menu ID
to look up the associated information in a CArray, CList, or CMap, or I've sometimes done
owner-draw menus and put a pointer to the object in as the menu data, and draw the menu
item myself based on that data.
                                joe

Quote:

>Hey Friends
>  I am developing a MDI Based Application in which I want
>Some Menus to be added dynamically.Can someone tell how to
>assign the work to these dynamically created menus.
>I am using AppendMenu Function for the same.

>     MFC will Disable the menus for which there is no
>event handler .Now how do I click on the button.
>Please Help.


Joseph M. Newcomer [MVP]

Web: http://www3.pgh.net/~newcomer
MVP Tips: http://www3.pgh.net/~newcomer/mvp_tips.htm


Tue, 05 Apr 2005 03:33:49 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Dynamically creating view from a single doc

2. Doc-view arch without a file

3. Doc-view SDI arch

4. setting focus in doc/view arch

5. REOPEN a Document in the Doc / View Arch

6. REOPEN a Document in the Doc / View Arch

7. Doc-view arch without a file

8. CListView in the Doc/View Arch

9. Question MDI Doc/View Arch..

10. REOPEN a Document in the Doc / View Arch

11. How can i create menu in Doc/View Frame

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

 

 
Powered by phpBB® Forum Software