Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Drilling Down to Objects
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00570451
Message ID:
00570505
Views:
26
Here is the Valid method code from a button that generates a report using some data fields on the form.


lcErrorMsg = ""
lcCR = ""
llFocusReset = .F.

IF THIS.PARENT.chkUseMPURateType.VALUE
SELECT RateValue
LOCATE FOR SetNumber = RateSet.SetNumber AND RateType = MPU.C_MPU_Rate
IF ! FOUND()
SELECT RateType
LOCATE FOR RateType = MPU.C_MPU_Rate
IF FOUND()
lcRateDescript = TRIM(DESCRIPT)
ELSE
lcRateDescript = MPU.C_MPU_Rate
ENDIF
lcErrorMsg = lcErrorMsg + ;
"The selected Rate Set does not contain rates for the MPU Rate Type of '" + ;
lcRateDescript + ;
"'. Select a different Rate Set or uncheck 'Use MPU Rate Type?'."
IF ! llFocusReset
THIS.PARENT.cboRateSet.SETFOCUS()
llFocusReset = .T.
ENDIF
lcCR = CHR(13)
ENDIF
ENDIF
IF THIS.PARENT.txtAdPercent.VALUE < 0
lcErrorMsg = lcErrorMsg + lcCR + ;
"Enter 'Ad Percent' greater than or equal to zero."
IF ! llFocusReset
THIS.PARENT.txtAdPercent.SETFOCUS()
llFocusReset = .T.
ENDIF
lcCR = CHR(13)
ENDIF
IF ! THIS.PARENT.chkUSAMPUWeight.VALUE AND ;
THIS.PARENT.txtUSAPieceWeight.VALUE <= 0
lcErrorMsg = lcErrorMsg + lcCR + ;
"Enter 'USA Piece Weight' greater than zero or check 'Use USA MPU Weight?'."
IF ! llFocusReset
THIS.PARENT.txtUSAPieceWeight.SETFOCUS()
llFocusReset = .T.
ENDIF
lcCR = CHR(13)
ENDIF
IF ! THIS.PARENT.chkCanadaMPUWeight.VALUE AND ;
THIS.PARENT.txtCanadaPieceWeight.VALUE <= 0
lcErrorMsg = lcErrorMsg + lcCR + ;
"Enter 'Canada Piece Weight' greater than zero or check 'Use Canada MPU Weight?'."
IF ! llFocusReset
THIS.PARENT.txtCanadaPieceWeight.SETFOCUS()
llFocusReset = .T.
ENDIF
lcCR = CHR(13)
ENDIF

IF ! EMPTY(lcErrorMsg)
? CHR(7)
WAIT CLEAR
MESSAGEBOX(lcErrorMsg, 48, "Data Entry Error")
ELSE
THISFORM.Visible = .F.
THISFORMSET.CreateReport()
THISFORM.Visible = .T.
ENDIF

<\PRE>

Hope this helps.

>Hi All,
>
>I understand how to drill down to various objects on a form but how can you tell which object is first (in Tab order) on the form (or container) while drilling down?
>
>For example if I called the valdation method of an object and wanted to set focus to the first object that failed. How?
>
>
>Thanks
>
>Robert
Dennis Lindeman
Previous
Reply
Map
View

Click here to load this message in the networking platform