Print Page | Close Window

Disable Menu Items

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=1257
Printed Date: 05 July 2024 at 12:06am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Disable Menu Items
Posted By: Trond
Subject: Disable Menu Items
Date 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




Replies:
Posted By: SuperMario
Date Posted: 10 October 2004 at 8:05pm
Read this post, it should answer your queations:
https://forum.codejock.com/forum_posts.asp?TID=607&PN=1 - 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


Posted By: Trond
Date 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



Posted By: SuperMario
Date 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.


Posted By: gsaez78
Date Posted: 09 May 2005 at 11:31pm
CommandBars.ActiveMenuBar.FindControl(, ID, , True).Enabled = False




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net