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

Disable Buttons

Status
Not open for further replies.

MDoom

Programmer
Aug 31, 2001
52
0
0
US
Attempting to disable some buttons on a screen. I checked off the 'Initially Disable' checkbox in the screen design but the buttons still remain enabled at first opening/running of the screen. I re-generated the screen and no success. Any ideas??
Thanks
 
Hi MDoom,


The trick we use, is to add

PROCEDURE ButtonSet
** enable/disable buttons before READ statement
SHOW GET m.TheButton DISABLE
RETURN .T.

And then change the READ statement to
READ <other params> WHEN ButtonSet()

This way, the buttons are enabled/disabled just before the READ cycle kicks in.


Hope this helped,

Jan Schenkel.

&quot;As we grow older, we grow both wiser and more foolish at the same time.&quot; (De Rochefoucald)
 
Do you have a SHOW GETS ENABLED somewhere? This will toggle your Initially Disabled setting at runtime.

Let me add to jschenke's post.
If you have a command button set, i.e., more than 1 button for a variable, you can toggle the status of the individual buttons by using:

SHOW GET abc, 1 disabled
SHOW GET abc, 2 disabled
SHOW GET abc, 3 enabled

This will disable the first two buttons, and leave the third enabled. Also, if a single button is disable via the:
'\\' picture clause, like \\Quit, it can later be overridden with the SHOW GET abc ENABLED also.
Dave S.
 
There is a SHOW GETS ENABLE in the REFRESH procedure but removing that messes with operation of the other buttons.
I've tried adding 'SHOW GET ... DISABLE' statements in the setup code snippet without success.
Also, if I create a ButtonSet Procedure, where or which code snippet do you access the READ statement?
thanks
 
SHOW GETS ENABLE enables ALL gets.
After the SHOW GETS ENABLE statement in the refresh snippet, put in the code to disable your button(s) you want disabled. The setup snippet happens before the refresh snippet so it won't work there.
Or, you can put the buttonset call in the refresh snippet.
Dave S.
 
thanks alot...putting the SHOW GETS.... DISABLE at the end of the refresh procedure works like a charm.
thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top