Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Disabling button
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Disabling button

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


Joined: 13 March 2007
Location: United States
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Carter Quote  Post ReplyReply Direct Link To This Post Topic: Disabling button
    Posted: 13 March 2007 at 8:28am
Hi, I'm trying out this software and i seem to have most of it working.  What i'm having problems with is being able to disable a button??  I  checked the tutorials and it only shows how to use "disabled icons" for disabled buttons.  could someone helpe me out?
 
Thanks
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: 13 March 2007 at 11:31am
Try declaring a global boolean variable then in the Update event set enabled propert of the button to the variable. 

In General Declarations:

dim blnBatchDetails as boolean
Const ID_BATCHDETAILS = 1

in CommandBars_Update event:

Select Case Control.ID
    Case ID_BATCHDETAILS
        Control.Enabled = blnBatchDetails
End Select
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: 13 March 2007 at 11:33am
Sorry, I should have followed up.  When you want to disable or enable a button, all you have to do is change the value of the boolean variable and the update event will do the rest.
Back to Top
Carter View Drop Down
Newbie
Newbie


Joined: 13 March 2007
Location: United States
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote Carter Quote  Post ReplyReply Direct Link To This Post Posted: 13 March 2007 at 7:58pm
thanks for the reply.  I am not sure what you mean.  I created a Commandbar object called "CommandBars" (like the sample).  I did see the UpdateEvent when i clicked the events button in the properties window and it showed up in the code behind file.  I still don't know how to call the event though?? 
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: 14 March 2007 at 8:53am
You don't have to call the event.  It runs automatically every few milliseconds.  Just put the Select Case in the Update Event.  If you have a case for each of the buttons that you may want to enable/disable, the update event will update their enabled status to the value of the boolean variable every time it runs.  It sounds like a lot of overhead but you shouldn't notice any performance problems.
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.046 seconds.