Trying to disable Menu Item and ToolbarCtrl item.. 
Author Message
 Trying to disable Menu Item and ToolbarCtrl item..

Sounds easy enough right?

Well I thought so too but have not had the desired results..

I am getting the menu from withing the mainfram GetMenu()

I get it then use:
menu->EnableMenuItem(id, MF_GRAYED);

This I thought should have done it.  The return value seems to be valid but
still no disabling is taking place

As for the toolbar I do
toobarctrl.EnableButton(id,FALSE);

Again this seems to return valid results but it is not disabled.

Any ideas? anybody?

Thanks,




Sun, 04 Jul 1999 03:00:00 GMT  
 Trying to disable Menu Item and ToolbarCtrl item..

This worked great.  Thanks for your help.

--didier



Sun, 04 Jul 1999 03:00:00 GMT  
 Trying to disable Menu Item and ToolbarCtrl item..

Quote:

> Sounds easy enough right?

> Well I thought so too but have not had the desired results..

> I am getting the menu from withing the mainfram GetMenu()

> I get it then use:
> menu->EnableMenuItem(id, MF_GRAYED);

> This I thought should have done it.  The return value seems to be valid but
> still no disabling is taking place

> As for the toolbar I do
> toobarctrl.EnableButton(id,FALSE);

> Again this seems to return valid results but it is not disabled.

> Any ideas? anybody?

> Thanks,



Go back to the class wizard where you first created the handler for the
menu item. Click on the UPDATE_COMMAND_UI choice to create an update
handler for the menu item/button that you want to disable. Then use
something like...

        if(iMyFlag) pCmdUI->Enable(FALSE);
        else pCmdUI->Enable(TRUE);
--
Cecil Galbraith

Free programmer's utilities and MFC tips at
http://www.concentric.net/~cgalbrai



Sun, 04 Jul 1999 03:00:00 GMT  
 Trying to disable Menu Item and ToolbarCtrl item..



Quote:
> Sounds easy enough right?
> Well I thought so too but have not had the desired results..
> I am getting the menu from withing the mainfram GetMenu()
> I get it then use:
> menu->EnableMenuItem(id, MF_GRAYED);
> This I thought should have done it.  The return value seems to be valid
but
> still no disabling is taking place
> As for the toolbar I do
> toobarctrl.EnableButton(id,FALSE);
> Again this seems to return valid results but it is not disabled.
> Any ideas? anybody?
> Thanks,

1) You would add a MF_BYCOMMAND or MF_BYPOSITION before MF_GRAYED.
2) Be sure the id of CToobarControl is valid.

Good Luck
Jiang



Tue, 13 Jul 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. trying to disable a menu item

2. Disable menu item in popup menu

3. How to disable/enable Popup menu item of the main menu

4. Enabling/Disabling Menu items for a menu on a dialog application

5. Disable CTreeCtrl item/items

6. SendMessage problem trying to select a menu item

7. Disabling a menu item

8. Enable and Disable Menu Items

9. WTL: Enabling and disabling menu items

10. Context Menu Problems, items are disabled

11. Disable default menu items

12. How to disable/enable menu item?

 

 
Powered by phpBB® Forum Software