Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Order of loControl
Message
From
24/10/2002 16:56:39
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Order of loControl
Miscellaneous
Thread ID:
00715160
Message ID:
00715160
Views:
35
I have a form with controls. During the saving of the record the program validates the data. Each control has a property - .lRequired that is .t. if the control is required to be filled in with data - a name for example. I would like for loControl to be in the tabindex order of the screen. I am trying to write a more universal routine than the one we have now that checks a control at a time. We seem to forget to include validation when we turn on one control at a time. Duh, huh? The problem is that the one we have now checks the controls one at a time in the order they occur in the .rec_valid method and we can place them there in any order we want. The one I am writing now checks the controls in the order of loControl array. I'm looking for a way to easily order the loControl array to match the order of the tabindex for the screen. Comments?

The example of the loop in its current state is -

LOCAL loControl, lcReQMsg, llNoPass, lcSetFocus
FOR EACH loControl IN This.Controls
* The following will work for character and date and time.
IF TYPE("loControl.txtTextBox") <> "U" AND ;
EMPTY (loControl.txtTextBox.Value)
llNoPass = .T.
lcSetFocus = "loControl.txtTextBox.Setfocus()"
ENDIF
IF TYPE("loControl.edtEditBox") <> "U" AND ;
EMPTY(loControl.edtEditBox.Value)
llNoPass = .T.
lcSetFocus = "loControl.edtEditBox.Setfocus()"
ENDIF
IF llNoPass
IF TYPE("loControl.cReqMsg") = "C" AND ;
!EMPTY(ALLTRIM(loControl.cReqMsg))
lcReQMsg = ALLTRIM(loControl.cReqMsg) + " is a required field. " + ;
"Please re-enter."
ELSE
lcReQMsg = "You have failed to enter a required field. " + ;
"Please re-enter."
ENDIF
=MESSAGEBOX( lcReqMsg, MB_OK + MB_ICONEXCLAMATION, goApp.cSysTitle )
&lcSetFocus
RETURN .F.
ENDIF
ENDIF
NEXT loControl

Thanks in Advance

sjwilson
Next
Reply
Map
View

Click here to load this message in the networking platform