Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Disable Menu Items
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Disable Menu Items

 Post Reply Post Reply
Author
Message
Trond View Drop Down
Newbie
Newbie


Joined: 04 October 2004
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Trond Quote  Post ReplyReply Direct Link To This Post Topic: Disable Menu Items
    Posted: 10 October 2004 at 2:50pm

I can successfully disable and enable toolbar buttons on a commandbar, but I am not able to disable and enable menu-items on toolbar.

What is the correct syntax?

Another one: I want to activate the popup-menu on a commandbar from my code.

Thank you,
Trond

Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 10 October 2004 at 8:05pm
Read this post, it should answer your queations:
https://forum.codejock.com/forum_posts.asp?TID=607&P N=1

Basically, to find a control in the Activemenubar you must set the recursive flag to True in the ActiveMenuBar.FindControl method. 

To find a popup control you must manually set the id of the control so you can find it.  even if you specify an id when the popup control is created you must still set the id property of the control.

Hope this helps


Edited by SuperMario
Back to Top
Trond View Drop Down
Newbie
Newbie


Joined: 04 October 2004
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote Trond Quote  Post ReplyReply Direct Link To This Post Posted: 11 October 2004 at 2:59am

Thank you but that did not help.

I have made the menu in CommandBarsDesigner and I am using those ID's that is generated there.

This code will return the object on normal toolbars:
Commandbars.FindControl(  , ID_CUT , , ' )

This code will return nothing on menubar:
Commandbars.ActiveMenuBar.FindControl(  , MNU_OPENFILE  ,  , True )

Yes, I am sure that the MNU_OPENFILE number is correct.

Best Regards,
Trond



Edited by Trond
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 19 October 2004 at 12:16pm
If you are trying to find a popup menu, i.e. File, Edt, View, etc... the designer does not assign an ID to these controls, you will need to make sure you click on the popup control and fill in a constant for the ID.  To do this, you will need to go to CommandBars->Resource Symbols... and click on the "New" button to create a constant to assign to the popup.  Then in your FindControl code you can search for this constant.

 "Another one: I want to activate the popup-menu on a commandbar from my code."
 
    Dim cmd As CommandBarPopup
    Set cmd = CommandBars.ActiveMenuBar.FindControl(, ID_FILE, , True)
    cmd.Execute

In the above code, I added the constant ID_FILE using the method described above int he designer.
Back to Top
gsaez78 View Drop Down
Newbie
Newbie


Joined: 07 May 2005
Location: Chile
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote gsaez78 Quote  Post ReplyReply Direct Link To This Post Posted: 09 May 2005 at 11:31pm
CommandBars.ActiveMenuBar.FindControl(, ID, , True).Enabled = False

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.