![]() |
onClick Disable a CommandBars ToolBar Button |
Post Reply ![]() |
Author | |
daveED ![]() Newbie ![]() Joined: 16 August 2006 Location: Australia Status: Offline Points: 37 |
![]() ![]() ![]() ![]() ![]() Posted: 06 September 2006 at 8:34am |
Hi,
I need to disable a Toolbar button when i fire a event
from a command Button how do i capture this event?
![]() A way i have using is this and works but is there a easer way?
Private Sub CommandBars_Execute(ByVal Control As XtremeCommandBars.ICommandBarControl)
Select Case Control.Id Case ID_VOLUME_CONTROL: hiddenButton.Enabled = False
End Select
Private Sub CommandBars_Update(ByVal Control As XtremeCommandBars.ICommandBarControl)
On Error Resume Next
Select Case Control.Id Case ID_VOLUME_CONTROL:
If hiddenButton.Enabled = False Then
Control.Enabled = False
Else Control.Enabled = True End If End Select -----------------------------------------------
Is there a easyer way? eg
------------------------------------------------
Private Sub disableSpeaker_Click()
CommandBars.Actions(ID_VOLUME_CONTROL).Enabled = False
End Sub
--------------------------------------------
eg, Example
--------------------------------------------
Private Sub CommandBars_Update(ByVal Control As XtremeCommandBars.ICommandBarControl)
On Error Resume Next
Select Case Control.Id Case ID_VOLUME_CONTROL:
If Text2.Text = "" Then
Control.Enabled = True
Else
Control.Enabled = False
End IF
End Select
End Sub
Regards,
Dave
|
|
![]() |
|
jcollier ![]() Senior Member ![]() Joined: 15 February 2006 Status: Offline Points: 250 |
![]() ![]() ![]() ![]() ![]() |
Try this:
Select Case Control.Id Case ID_OF_BUTTON_USER_CLICKED:
CommandBars.FindControl(, ID_OF_BUTTON_TO_DISABLE, , True).Enabled = False End Select |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
FindControl is the worst solution. User can move control or delete, or copy to another toolbar.
I like 2 solutions
1. create variable (dim State as Boolean) and switch it in Execute.
or
2. use Actions.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
daveED ![]() Newbie ![]() Joined: 16 August 2006 Location: Australia Status: Offline Points: 37 |
![]() ![]() ![]() ![]() ![]() |
![]() |
|
as above so below
|
|
![]() |
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 |