Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Button not dimmed

Status
Not open for further replies.

peruchoa

Programmer
Apr 10, 2000
6
VE
I have a screen form with a button that I disable if I'm going to add records, otherwise the button is active.<br><br>Now, in the When() properties of the button I can disable but the button remains bright, not dimmed.<br><br>That's my question: how to dimmed the button ?<br><br>Thanks in advance for your help.<br>
 
Try to disable the button not from within the button's When method (since When is activated only when control is passed to this button) but from Click (or other appropriate event)method of the control which make you decide to Add records. Did I make myself clear?
 
Hi Perucha,<br>&nbsp;&nbsp;A good programming technique to use, when speaking of enabling/disabling controls, is to use the Refresh() event of the control.<br><br>For Example:<br><br>If you have a command button you only want enabled when the user has entered something into a text box (example: a password text box and login button), you would put code in the refresh event of the button that looks like this:<br><br>THIS.ENABLED = ! EMPTY(THISFORM.txtPassword.Value)<br><br>In the textbox's Interactive Change event, you would call THISFORM.REFRESH(). This way, anytime the user changes the contents of the textbox, the command button will check and see if it needs to be disabled or enabled.<br><br>And in the Form's refresh event, its also good practice to explicitly refresh the controls that have code in their refresh method. Example: In the form's refresh:<br>THIS.cmdLogin.REFRESH()<br><br>HTH<br><br>Jon<br>
 
THANK YOU Jonscott8 !!!<br><br>Four days fighting with the little button, the solution it's done.<br><br>Thank you Amakovoz too.<br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top