Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Chaning the state of a CommandBar Control
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Chaning the state of a CommandBar Control

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


Joined: 29 December 2004
Location: United Kingdom
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote amorton Quote  Post ReplyReply Direct Link To This Post Topic: Chaning the state of a CommandBar Control
    Posted: 03 January 2005 at 1:21pm
Hello have been trying to write some code to disable a menu option in the command bar. I followed the documentation and used the "DesignerControls" controls collection off the command bars control to find a control and change its enabled property. This did nothing.

Eventually i found the "Update" event, in the online help it says "Occurs when a command bar control has been updated." (and not much else)  which more than implies it is fired *after" a control has been updated. However one of the tutorials implies that if i want to disable a menu option the only place i can do it is in the "Update" event.

So my questions are....
1) Is there are way to select a control from the command bars and disable it outside of the Update event ?

2) Is the only way to change the state of a command bar control  in the Update event ?

3) What is the trigger for the Update event to fire for a particular control ? The online help says of the "control" param "The command bar control which has been updated." so what do i need to do to inorder for a control to be considered Updated ?

thanks for any help.
aaron

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: 03 January 2005 at 5:11pm
1. Yes, Update event is only one way to do it.  You can simply use one of the Find method to find the control and change its properties.  Change them in the Controls collection, not the DesignerControls.  Do a search on forum for DesignerControls, I have explained them a few times

2. No

3. It is fired every 100 milliseconds by default.  You can change this by setting the UpdatePeriod property.
Back to Top
amorton View Drop Down
Newbie
Newbie


Joined: 29 December 2004
Location: United Kingdom
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote amorton Quote  Post ReplyReply Direct Link To This Post Posted: 04 January 2005 at 9:48am
Thanks for that. I looked at the other posts and discovered what i was missing. I did not realise i needed to call FindControl with the recursive param set. As i was calling it on the control itself and not on a command bar i did not think it was necessary.

Is there a way to disable the update event ? I tried setting the UpdatePeriod property on the commandBarsOptions object to zero but that just made it run as fast as it could.

I realise i could  just not implement an event handler but if i do that will the control still be fireing the event ?

thanks
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: 04 January 2005 at 9:51am
You cant disable it, but you could set the UpdatePeriod to something like every 10 minutes.  Or you could have some variable that controls if the conde in the Update event is executed.
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.172 seconds.