Information générale
Catégorie:
Programmation Orientée Object
Titre:
Messagebox, Focus and Class Object problem...help!
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
ENDIF
ELSE
*********************
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
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement