trying to add menu to dialog based app 
Author Message
 trying to add menu to dialog based app

Hello,

Would someone please help me with the following:
I have added menu to dialog based application, but I need to be able to
enable/disable/SetCheck, etc. some of the menu items during the program's
execution.

void CKitDlg::OnUpdateConfigurationSerial(CCmdUI* pCmdUI)
{
 // TODO: Add your command update UI handler code here
  pCmdUI->SetCheck(TRUE);

Quote:
}

I got as far as   pCmdUI->SetCheck(TRUE); being called but using de{*filter*} it
goes to:
\Mfc\Src\Wincore.cpp

void CTestCmdUI::SetCheck(int)
{
 // do nothing -- just want to know about calls to Enable

Quote:
}

What is the chronological order of things to do to get this working from
scratch? I probably made some incorrect assumptions/steps.

Thanks,

Lubo



Tue, 04 Mar 2003 03:00:00 GMT  
 trying to add menu to dialog based app

Quote:

>What is the chronological order of things to do to get this working from
>scratch? I probably made some incorrect assumptions/steps.

No you were doing fine, you just can't get there from here :-).

The code which implements the update command UI mechanism is in
CFrameWnd, but dialogs inherit from CWnd, not CFrameWnd, so you don't
get that code. Bummer.

Instead, try handling WM_INITMENUPOPUP and rolling your own update
code. I hear some people have had good luck just nicking the code from
CFrameWnd. Sneaky....

--
Bob Moore [Microsoft MVP - WinSDK]
http://www.mooremvp.freeserve.co.uk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Due to an unreasonable amount of queries, I no
longer answer unsolicited email questions. Sorry,
no exceptions.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Tue, 04 Mar 2003 03:00:00 GMT  
 trying to add menu to dialog based app

Just to follow up on Bob's final remark, there is a kb article that documents this sneaky
technique...

Q242577 - PRB: Update Command UI Handlers Do Not Work for Menu Attached to a Dialog Box

Jeff...



Tue, 04 Mar 2003 03:00:00 GMT  
 trying to add menu to dialog based app
Take a look at http://www.*-*-*.com/

Jeremy


Quote:
> Hello,

> Would someone please help me with the following:
> I have added menu to dialog based application, but I need to be able to
> enable/disable/SetCheck, etc. some of the menu items during the program's
> execution.

> void CKitDlg::OnUpdateConfigurationSerial(CCmdUI* pCmdUI)
> {
>  // TODO: Add your command update UI handler code here
>   pCmdUI->SetCheck(TRUE);
> }

> I got as far as   pCmdUI->SetCheck(TRUE); being called but using de{*filter*}
it
> goes to:
> \Mfc\Src\Wincore.cpp

> void CTestCmdUI::SetCheck(int)
> {
>  // do nothing -- just want to know about calls to Enable
> }

> What is the chronological order of things to do to get this working from
> scratch? I probably made some incorrect assumptions/steps.

> Thanks,

> Lubo



Fri, 07 Mar 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Newbie : Adding Menu Bar and Tool Bar to Dialog Based App

2. dialog based app and try icon

3. Adding a minimize button to an existing dialog based app

4. Dialog based app menu

5. Dialog Based Apps - Menu & Windows :: MFC

6. Pop up menu in Dialog based App

7. adding a Minimise button to a dialog-based app

8. Adding a status bar to a Dialog-based App

9. creating pop-up menus with dialog based apps gets assert error

10. adding an icon to a propsheet dialog-based app

11. Menu enabling in Dialog-based app

12. Using a Menu in a Dialog-based app

 

 
Powered by phpBB® Forum Software