Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SET SKIP OF BAR question
Message
From
17/11/2006 11:17:37
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01170464
Message ID:
01170726
Views:
7
A better example then...
SKIP FOR cCurrentYear >= '1999'
I need this to be in place all the time. If cCurrentYear = '2004', the item is disabled and if the cCurrentYear = '1998' the item is enabled.


When the cCurrentYear is '1998', the user will be allowed to enter the form. In the init or load of the form I want to SET SKIP OF BAR n OF myMenu .T. This is to disable the item because it is now running and I don't want the user to execute the form a second time.


Now what I am hearing from the two suggestions is that I need to put specific menu code into my form in order to disable the menu item.

e.g.
* INIT or LOAD
* redefine the menu
DEFINE BAR n OF myMenu PROMPT "\<myPrompt"

* Then set skip
SET SKIP OF BAR n OF myMenu .T.
then in the DESTROY or UNLOAD
* reset skip
SET SKIP OF BAR n OF myMenu .F.

* redefine the menu
DEFINE BAR n OF myMenu PROMPT "\<myPrompt" ;
SKIP FOR cCurrentYear >= '1999'
This would mean that my form must be cognizant of the exact nature of the menu settings; not very object oriented. I would need to maintain the code in two places; once in the menu, and then again in the form.

There must be a better object oriented approach to this. I don't even like my idea...
* in the menu change to...
SKIP FOR cCurrentYear >= '1999' AND FormCheck('myFormName')


* global function defined in the mainline outside the application object.
PROCEDURE FormCheck
LPARAMETERS tcName
LOCAL loForm, llFound

llFound = .F.

FOR EACH loForm IN _SCREEN.Forms
	IF loForm.Name == tcName
		llFound = .T.
		EXIT
	ENDIF
ENDFOR

RETURN llFound
This will not handle multiple calls to the same form with different parameters. Using the Caption won't work because the Caption might change in the INIT or LOAD of the form depending on the cCurrentYear. Too many holes!

Any ideas?




>Control the bar enabled status either by
>
... SKIP FOR Something()
>or with
>
SET SKIP OF BAR 1 OF file .T.
>
>All the best
>
>
>>Does anyone know how to use the SET SKIP OF BAR when the menu already has a SKIP FOR clause?
>>
>>e.g.
>>
>>This would be defined in the menu.MPR. If something() returns true, then the item is disabled otherwise it is enabled.
>>
>>
>>DEFINE POPUP file MARGIN RELATIVE SHADOW COLOR SCHEME 4
>>DEFINE BAR 1 OF file PROMPT "\<Test" ;
>>	SKIP FOR Something()
>>
>>
>>
>>In your form INIT code you would use something like the following:
>>
>>
>>SET SKIP OF BAR 1 OF file .T.
>>
>>
>>Here we want to disable the first item in the file menu. If Something() is returning false, even with the SET SKIP OF BAR telling it to be TRUE, the first item will still be enabled.
>>
>>Does anyone know how to get around this?
Gordon de Rouyan
DC&G Consulting
Edmonton, Alberta
Email: derouyag@shaw.ca
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform