Print Page | Close Window

Disabling 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=6631
Printed Date: 19 June 2025 at 5:33am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Disabling button
Posted By: Carter
Subject: Disabling button
Date 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



Replies:
Posted By: jcollier
Date 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


Posted By: jcollier
Date 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.


Posted By: Carter
Date 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?? 


Posted By: jcollier
Date 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.



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