Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dialog doing what it's not supposed to
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01084652
Message ID:
01084659
Views:
19
I don't see where you initialize texbox with appropriate initial value.

>We've talked about the DWIM() function (do what I mean) but now my dialog needs a DWYUTD() (Do what you used to do) function. It has always worked perfectly, was perfected years ago, and has today started going wrong.
>
>On the table list page of my forms, with its grid, there is a generic GoTo button class. This is so the user can type in directly the key to a record and go straight to it, rather than scroll through a large table. This button calls a GotTo dialog which has been made to deal with any data type. A param passed to it gives the length of the field, so a CR ends input and goes to the Valid() method of the input text field.
>
>Only now, the keystroke isn't being recognised and each keystroke takes you straight to the valid clause.
>I put it under debug and the code is operating exactly as it should. But as soon as it's out of debug the above problem exists. Hence the goto button returns no value at all.
>
>The goto button class code is as follows:
>
>
>*____________________________________________________________________________________
>LOCAL	lcType, lcKeyExp, lxValue, lcNearSet, lcOrder, lcField, lnFieldLen, llUpper
>
>llUpper			= thisform.lKeyUpper   && Upper case key search?
>If not EMPTY( ORDER())
>	lcType		= ALLTRIM( TYPE( ORDER()))
>	lcKeyExp	= ALLTRIM( KEY())		     && Field name from which key derived
>
>*	If the field is integer, there'll be just 4 bytes, but we may need to allow more digits
>*	than that, as numeric fields can hold in the millions.  Don't know from the table what
>* 	max length digits so just allow for 11
>*	______________________________________
>	If lcType = "N"
>	    lnFieldLen	= 11
>	Else
>	    lnFieldLen	= FSIZE( lcKeyExp)	     && How many chars/digs etc in key field
>	Endif
>	lcField		= ALLTRIM( ALIAS()) + "." + lcKeyExp
>	lcCaption		= DBGETPROP( lcField, "Field", "Caption")
>	DO FORM GoToDlog with lcType, lcCaption, lnFieldlen, llUpper to lxValue
>	lcNearSet		= SET("NEAR")
>	Set Near on
>	If lcType = "C"
>	    lxValue	= ALLTRIM( lxValue)
>	EndIf
>	If not EMPTY( lxValue)	              && So if cancelled or null doesn't shoot to EOF
>	    If not INDEXSEEK( lxValue, .T.)	     && If not found stay where you are
>	        Wait WINDOW "Record not found in table" TIMEOUT 4
>	    EndIf
>	Endif
>	Set Near &lcNearSet
>	This.Parent.Refresh()
>Endif
>*____________________________________________________________________________________
>
>
>The Init() of the dlog as as follows:
>
>*____________________________________________________________________________________
>LPARAMETERS    tcType, tcCaption, tnMaxLength, tlUpper
>LOCAL	      lnNoParams
>
>lnNoParams	    = PARAMETERS()
>With Thisform
>  .cType		    = UPPER( tcType)
>  .lblField.Caption   = tcCaption
>  With .txtField
>    If lnNoParams = 4
>        If tlUpper
>            .Format   = "!"
>        EndIf
>    Endif
>    If not EMPTY( tnMaxLength)
>    	.MaxLength   = tnMaxLength
>    Endif
>    DO CASE
>      Case Thisform.cType = "C"
>      Case Thisform.cType = "N"
>        .Format	    = "Z"
>      Case Thisform.cType = "D"
>        .Format	    = "DR"
>        .InputMask	    = "99-99-9999"
>        .DateFormat   = 13	&& system Short Date
>    EndCase
>  EndWith
>EndWith
>*____________________________________________________________________________________
>
>
>As you can see the .MaxLength is being set according to the param. I just can't understand why it's going to the .valid with each keystroke. Am I missing something here? Can anyone shed some light?
>
>'ppreciate it
>
>Terry
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform