Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Enabling Command Buttons
Message
From
27/11/2002 06:09:23
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00727465
Message ID:
00727473
Views:
10
Hi!

I usually have a method on the form called "RefreshButtons" or something like this. The reason that in the future you probably require something similar for otehr buttons etc. etc. and putting tonnes of the same code into LostFocus of each control is nto a good idea. Just call that form's method, and the rest will take care the code in there (check for valid conditions to enable/disable buttons, for example). The code in my method looks usually as follows:
With thisform.MyButtons
  .Command1.Enabled = !empty(thisform.txtMyTextBox) AND ...
  .Command1.Caption = "Add " + iif(thisform.cboTypes.ListIndex=1,"Somethin 1",iif(...))
EndWith
HTH.

>Hi!
>
>What's the best way of enabling a command button if certain fields on a form a filled in the way you want them?
>
>I'm sticking my condition in to the refresh of the button, then calling a refresh of the button in each of the lost focus events of the fields in question.
>
>IE this.enabled=gauge<>0 and length<>0 etc etc.
>
>Surely there must be a better way of doing this?
>
>Thanks in advance
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Reply
Map
View

Click here to load this message in the networking platform