General information
Category:
Object Oriented Programming
Hello Joe
This appears to be confusion with the event firing sequence
If you do a SET EVENT TRACKING ON
at the point in you code where things appear to be going wrong
you will be able to see what is going on here.
It may be that you will have to use Lostfocus() instead of VALID() for some of your functionality.
Good Luck
>I have a textbox class object which I am using to build data collection text boxes and grids. I have tons of functionality in the class object to evaluate the data being entered (both alpha and numeric), determine color of text box depending on the data entered, automatically advance to next object if the input mask is met, etc., etc. My problem is this:
>
>I'm attempting to add code that will display a message box when the data entered is outside the spec limit range. The operator can override the warning message and accept the out-of-range reading, or choose to go back and re-check the measurement.
>
>On TXTGRID.Valid (my textbox class), I have the following code (among lots of other code):
>
>IF this.advance && the txtgrd evaluates .T. to move focus to next object
> THIS.REAS_LIM
>
> IF upper(THIS.PARENT.PARENT.BASECLASS) = 'GRID'
> ** if normal keyboard entry numbers, letters, shift+letters, TAB, ENTER, rightarrow, dnarrow advance down 1
> IF (between(LASTKEY(), 48,57) or between(LASTKEY(), 97,122) or between(LASTKEY(), 65,90) OR INLIST(LASTKEY(),9,13,4))
>
> IF this.parent.parent.activerow = thisform.gridmax
> keyboard '{ctrl+tab}'
> NODEFAULT
> else
> KEYBOARD '{CTRL+DNARROW}'
> NODEFAULT
> ENDIF
> endif
> ENDIFELSE
>*********************
>
>
>TXTGRID.REAS_LIM:
>
>IF datentry.reas_min > datentry.var OR datentry.reas_max < datentry.var
> nRet=MESSAGEBOX('WARNING: The value input is outside the reasonable limit range! Do you want to accept it?', 4+32+256,'Reasonable Limits Deviation')
> IF nRet = 7 && nRet = NO
> this.stayput = .T.
> ELSE && nRet = YES
> this.stayput = .F.
> ENDIF
>ENDIF
>*********************
>
>
>TXTGRID.GotFocus:
>
>IF this.stayput = .T.
> this.stayput = .F.
> keyboard '{backtab}' && focus moves back to previous object
>ENDIF
>*********************
>
>This code works fine except that I always get the messagebox TWICE, and I can't figure out why. If you have any ideas, they would be GREATLY appreciated.
>
>Thanks in advance,
>
>Joe
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only