Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Enable and disable buton on form
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00458546
Message ID:
00458567
Views:
12
>I have a form with several command buttons. All are enabled by default. I have one that I disabled in the propeties for the button. I don't quite understand the how to enable the button if say cUseName="RJOHSNON" I did this int the INT Method of the button:
>
>If cUserName="RJOHNSON"
> cmdClose_accounts.enable= .T.
>endif

It seems to me that you're probably refering to a variable that's not on the Form's Init scope.

If you want to enable the button when the user writes "RJOHNSON" inside a textbox, you can do it in the textbox Valid() or InteractiveChange().

If you want to enable it conditionally on a certain field, then you can do it in the button's Init as:
this.enabled = ( MyTable.cUserName="RJOHNSON" )
Just check that MyTable is open. Remember that the first event that fires is the Form's Load, then each control Init(), and FINALLY form's Init(). so the best place to open your tables is the form's Load.

Hope this helps.
Previous
Reply
Map
View

Click here to load this message in the networking platform