Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SKIP FOR expression
Message
From
17/01/2005 23:37:44
 
 
General information
Forum:
Visual FoxPro
Category:
Menus & Menu designer
Environment versions
Visual FoxPro:
VFP 7 SP1
Miscellaneous
Thread ID:
00977929
Message ID:
00977946
Views:
19
>In the SKIP FOR expression of a menu item I want to refer to a property of the form. This works well if I declare global variables for my forms (like goSomeWindow), but that trick only works well if the form won't be instantiated more than once at the same time. The expression will then be something like:
SKIP FOR goSomeWindow.SomeProp = .T.
This trick has been my reaction to my finding that it is troublesome and frustrating to declare something like:
SKIP FOR _vfp.activeform.SomeProp = .T.
That expression gives an error if the form is out of scope and the expressions are evaluated anyway, for example if the form is minimized.
>
>But now I have a form that can be instantiated more than once at the same time, and my goSomeWindow trick won't work.
>
>Who knows another trick? I'm desperate ( again :).


Peter,

Use a function in the skip for clause
skip for !Bar17Allowed()
&& sample code, not tested

&& if SomeProp is hidden, then use type() instead of vartype()

function Bar17Allowed()
	
	local i, obj, MustSkip
	
	MustSkip = FALSE
	
	for i = _screen.FormCount to 1 step -1
	
		obj = _screen.Forms[m.i]
		
		if( inlist(vartype(m.obj), T_OBJECT) and inlist(vartype(m.obj.SomeProp), T_LOGICAL) and m.obj.SomeProp )
			MustSkip = TRUE
			exit
		endif
	endfor
	
	return m.MustSkip 
endfunc
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform