Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SKIP FOR expression
Message
De
17/01/2005 23:37:44
 
 
À
17/01/2005 20:42:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de menu & Menus
Versions des environnements
Visual FoxPro:
VFP 7 SP1
Divers
Thread ID:
00977929
Message ID:
00977946
Vues:
21
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform