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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enable/Disable command buttons 1

Status
Not open for further replies.

Scott24x7

Programmer
Jul 12, 2001
2,819
JP
In my 2.6 days, I used to have a procdure called "SHOWGETS" which would change the value of whether fields & buttons were enabled or disabled based on the "STATE" of some screen values. (Like, M.EDITING, or M.ADDING). Now, all of my command buttons are ENABLED at all times on my form, and I don't really want that. How do I get them to change? For instance, I have a Save button, with a Memvar reference of M.SAVERECORD. In my SHOWGETS routine, it says:

SHOW GET M.SAVEREOCRD DISABLE

But, the button is still enabled. What do I need to do to togle this state for command buttons?

Thanks,
-Scott s-)
Please let me know if this has helped!
 
Generally you'd just do something like:

Code:
 thisform.mydisabledbutton.enabled = .T.

if you want to turn the button on, or = .F. if you want to turn it off.
 
OK... but is there a way to set the state of all Input objects on the screen? Like to make them all enabled, like a:

THISFORM.TEXTBOXOBJECST.ENABLE = .T.
THISFORM.COMMANDBUTONS.ENABLE = .T.

so that each individual object doesn't have to be tediously set on and off... Thanks,
-Scott

Please let me know if this has helped! s-)
 
Well, I'm sure you could create programs to do this, and make it a method of your standard form, but I'm not sure it'd be worth it. It'd seem to me that too often you'd want to just turn off some objects and turn on others and by the time you'd created a list of the ones you want off and the ones on and sent them as parameters of your method, It'd be quicker to just turn them on and off.
However, if you just want to disallow the user to click on buttons or the like there's a way to do it which has been brought up here a few times. Create a transparent shape to cover the whole form or whatever portion you want no entry to be allowed in and bring it to the top. You could even put code in the click event of the shape and bring up a message like "Data Entry not allowed at this time." Then when you do want to allow entry just move the shape to the back.

Dave Dardinger
 
Scott

THISFORM.SetAll([Enabled],.F.,[COMMANDBUTTON])

or

THISFORM.SetAll([Enabled],.F.,[COMMANDBUTTON])

Arg 1 = Property
Arg 2 = Value
Arg 1 = Class

Chris :)

 
Chris,
You are my FoxPro Patron Saint!
Thanks,
-Scott

Please let me know if this has helped! s-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top