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!

How do I disable everything in a form? 2

Status
Not open for further replies.

Menglish

Programmer
Jun 22, 2001
66
I need to disable all txt, cmd & etc. until a txt field losses focus (VendId) from an entry, then turn on all other fields.
IU know how to turn each one off individually, but I know there is a command that will do this.

Thanks for any suggestions...

Millard
 
Code:
thisform.SetAll("Enabled", .f.)
In Unit event if the form.

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
I use this method (like you described alot). And alot of times, i want certain things enabled, yet, some not, etc.. (i usually put my controls inside containers, to make them look nice, etc..)

so, i have this function inside my class, it comes in handy alot.

All I do is

Code:
EnableControl(Thisform.CntrCustInfo,.f.) && Disabled
EnableControl(Thisform.CntrItemInfo,.f.) && Disable

Then, when sometimes down the form, i need to enable just certain this:

EnableControl(Thisform.CntrPurchaseOrder,.t.) Enable
etc..

FUNCTION EnableControls(loControl,lOk)
	LOCAL loTxt,cname,cFieldType
	IF PCOUNT()= 0 OR TYPE("loControl") <> 'O'
		RETURN
	ENDIF


	FOR EACH loTxt IN loControl.OBJECTS
		cname = loTxt.NAME
		IF INLIST(UPPER(loTxt.BASECLASS),[TEXTBOX],[COMBOBOX],[CHECKBOX],[EDITBOX],[COMMANDBUTTON],[PAGE])
			loControl.&cname..ENABLED = lOk
		ENDIF
	ENDFOR
ENDFUNC

Ali Koumaiha
TeknoSoft Inc.
Michigan
 
Thanks to both of you. I have it working fine now.

Millard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top