Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Numeric field for year - detect 00 or no value entered?
Message
De
11/06/2004 09:13:35
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00912459
Message ID:
00912653
Vues:
7
Thanks for the idea Sergey. I'm trying to determine if this.text is '00' in the interactive change and if the lastkey entered was 13,9,15, or 24 then convert it to the year 2000. This only works if the user presses ENTER. IF the user presses TAB, SHIFT-TAB, or UP ARROW, or DOWN ARROW then it jumps right into the valid. I need to detect for '00' when the user exits the control. So far, it only works if the user presses ENTER to leave the control. Any ideas?
*Interactive Change
IF INLIST(LASTKEY(),13,9,5,15,24) .and. THIS.TEXT = "00"
	this.value = ADDCENT(this.value)
ENDIF

*Valid

*--Interactive change should have changed 00 to 2000 by now and all 
*--other entries left alone
IF EMPTY(this.value)
	this.value=YEAR(DATE())
ENDIF
IF UPDATED()
	mvh_Year(lvchoice) = AddCent(mvh_Year(lvchoice))
ENDIF
THIS.REFRESH()
RETURN .T.
>Tracy,
>
>You can try to check Text property in the InteractiveChange.
IF This.Text = "00"
>...
>
>>We have a textbox which holds a year value and is stored as numeric. I need to determine if the user entered a two digit year (in which case we convert it as below) for the year 2000 (the user would enter 00 then) or if he did not enter any value in which case the variable's value is 0 (it is initialized as 0 throughout the app) and in that case I want to set it to the current year by default. Any ideas? I must be missing something obvious? How to determine if he pressed enter without entering a value or if he entered 00? The below routine is called from the valid of the textbox for mvh_year which is initialized to 0 when it is created:
>>
>>
>>PARAMETERS CurrentYear
>>
>>PRIVATE iYear, iEpoc
>>iYear = CurrentYear
>>iEpoc = 20
>>
>>DO CASE
>>CASE CurrentYear = 0
>>	iYear = 2000
>>CASE CurrentYear < iEpoc
>>	iYear = 2000 + CurrentYear
>>CASE CurrentYear < 100
>>	iYear = 1900 + CurrentYear
>>ENDCASE
>>
>>RETURN iYear
>>
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform