Chaning the state of a CommandBar Control |
Post Reply |
Author | |
amorton
Newbie Joined: 29 December 2004 Location: United Kingdom Status: Offline Points: 10 |
Post Options
Thanks(0)
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 |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
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. |
|
amorton
Newbie Joined: 29 December 2004 Location: United Kingdom Status: Offline Points: 10 |
Post Options
Thanks(0)
|
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 |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
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.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |