Wiki Home

Vfe Menu Mod


Namespace: VFP
This makes the menus more tolerant to canceling the app when an error occurs. The original VFE code sets the SKIP FOR expression of each menu pad to an expression that references the applicaion object; if it goes out of scope, VFP starts having trouble figuring out what pads are enabled. This sets it so that it ignores it if the application object does not exist.

It does this by wrapping the original cSkipFor expression in an IIF that checks for the existance of the object that the skip for expression is a method of. If it finds it, it then calls the method; else it returns .f. (don't skip).

** Method: cpad::define() {c:\vfe6\vfeframe\libs\CMENUS.VCX}
IF !EMPTY(This.cSkipFor)

	lcSkipFor = ;
		lcSkipFor + " OR " + ;
		STRTRAN(This.cSkipFor, ;
		"This.", ;
		lcObjectPath)
ENDIF

* New code to wrap the SKIP FOR expression in an IIF
* that checks for the existance of the menu pad object.
*!*IF TYPE("goErrorHandler.Name") = "C" and goErrorHandler.lDeveloper
* Don't you mean:
IF TYPE("_SCREEN.oApplication.Name") = "C" and goErrorHandler.lDeveloper
	* slower, but tolerant to aborting.
	* won't try and evaluate the skip for if the app object is gone
	lcSkipFor = 'iif( type("this.' + lcObjectPath + '")="O", ' + lcSkipFor + ', .F. )'
endif
* end of new code

lcDefinePad = lcDefinePad + " SKIP FOR " + lcSkipFor


Contributors: Carl Karsten
Category Visual FoxExpress
( Topic last updated: 2000.06.29 07:24:19 PM )