Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Business Rules
Message
De
18/03/2004 11:40:22
Jason Mesches
Ocean Systems Engineering Corporation
Carlsbad, Californie, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
The Mere Mortals Framework
Titre:
Divers
Thread ID:
00887232
Message ID:
00887553
Vues:
11
Jose,
Couple of issues:

1. What does your "OK" button do? If it saves the data on your form, your rules are already being checked by the framework prior to the TABLEUPDATE() attempt. When program control returns to the OK button, you could set focus according to the contents of your BizRules class' aBrokenRules array:
LOCAL liLoop, loRuleObj, lcBrokenRule
loRuleObj = ThisForm.oBizObj.oBizRules
IF DODEFAULT() # FILE_OK
   FOR liLoop = 1 TO loRuleObj.GetCount()
      lcBrokenRule = loRuleObj.GetBrokenRule(liLoop)
      *You'd have to create a priority list here (DO CASE statement maybe?)
      *   for the potential broken rules and set focus based on lcBrokenRule value.
      
   NEXT liLoop
ENDIF
This gets fairly messy, which is why I was suggesting to check the rules in the valid routine.


2. Typically, CheckRules() is set up as a "master" method that calls others to validate specific fields:
*CheckRules() code
This.IsProjectNameValid()
This.IsField2Valid()
This.IsField3Valid()
This.IsField4Valid()
If you're using CheckRules() in this manner, you'll want to call the specific field validation routine(s) instead of the "master" method. Otherwise, you may create extraneous broken rules for validation routines you didn't intend to check.

Hope that makes sense,
---J

>Thanks Jason. Look what I did in the Click method of the "OK" button.
>
>
>LOCAL	loBizRules, llRetVal, lnRetVal
>
>loBizRules = ThisForm.oBizObj.oBizRules
>
>llRetVal = loBizRules.CheckRules()
>
>IF .NOT. llRetVal
>
>	This.Parent.txlProjectName.TextBox.SetFocus()
>
>ENDIF
>
>lnRetVal = DODEFAULT()
>
>RETURN (lnRetVal)
>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform