Print Page | Close Window

onClick Disable a CommandBars ToolBar Button

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=4981
Printed Date: 20 June 2025 at 5:58pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: onClick Disable a CommandBars ToolBar Button
Posted By: daveED
Subject: onClick Disable a CommandBars ToolBar Button
Date 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
 
 
 
 
 
 
 



Replies:
Posted By: jcollier
Date Posted: 07 September 2006 at 11:10am
Try this:

Select Case Control.Id
    Case ID_OF_BUTTON_USER_CLICKED:
    CommandBars.FindControl(, ID_OF_BUTTON_TO_DISABLE, , True).Enabled = False
 
End Select



Posted By: Oleg
Date Posted: 07 September 2006 at 2:34pm
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


Posted By: daveED
Date Posted: 10 September 2006 at 8:04am


-------------
as above so below



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