Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - onClick Disable a CommandBars ToolBar Button
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

onClick Disable a CommandBars ToolBar Button

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


Joined: 16 August 2006
Location: Australia
Status: Offline
Points: 37
Post Options Post Options   Thanks (0) Thanks(0)   Quote daveED Quote  Post ReplyReply Direct Link To This Post Topic: onClick Disable a CommandBars ToolBar Button
    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
 
 
 
 
 
 
 
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
daveED View Drop Down
Newbie
Newbie


Joined: 16 August 2006
Location: Australia
Status: Offline
Points: 37
Post Options Post Options   Thanks (0) Thanks(0)   Quote daveED Quote  Post ReplyReply Direct Link To This Post Posted: 10 September 2006 at 8:04am
as above so below
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.031 seconds.